I have a slight problem when trying to make a script which will generate random dummy data for testing. I'm still a n00b when it comes to linux system administration and shell scripting, but I figured out a command to generate a random date, that does exactly what I want it to do on the command prompt:
date -d "$((RANDOM%1+2010))-$((RANDOM%12+1))-$((RANDOM%28+1)) $((RANDOM%23+1)):$((RANDOM%59+1)):$((RANDOM%59+1))" '+%d-%m-%Y %H:%M:%S'
But as soon as I put it in a Bash shell script and run that script(even if I comment out everything else), it generates only one date:
I suspect it has something to do with the formatting of the command for scripting and I've been trying alot of variations for placing, (), "", '', ``, etc., but I can't seem to figure out why it doesn't work.
Can someone please explain to me what I'm doing wrong!!! I'm greatful for any help anyone might have.