When I backup a file, I add a timestamp to it.
For example:
$ DATE=$(date +%F)
$ cp file{,.$DATE.bk}
$ ls
file file.2012-06-20.bk
There is a bash variable RANDOM, every time I echo it, it gives me different values:
$ echo $RANDOM
20511
$ echo $RANDOM
12577
$ echo $RANDOM
32433
How can I define such kind of a variable DATE?
You need to edit the bash source code in order to provide it. But make sure you know what format everyone wants their date in before doing it.