'Why am I getting the same number when I call $RANDOM in this context?
I wrote a simple bash alias to create a sort of daily tmp directory to work in:
alias datdir="mkdir $(date +'%m_%d_%Y')___$RANDOM"
When I call it repeatedly on the same day, I get this:
mkdir: cannot create directory ‘02_04_2022___24499’: File exists
However, when I simply run echo $RANDOM on the terminal, I get different numbers.
I'm running Git Bash on Microsoft Windows 10 Business, Version 10.0.19044 Build 19044
$ bash --version
GNU bash, version 4.4.23(1)-release (x86_64-pc-msys)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
