On Wed, Mar 23, 2011 at 6:09 PM, Rony Bill gnulinuxist@gmail.com wrote:
Hello,
I am creating / appending files using a variable as the input name. Eg. $USER.jpeg makes a file called rony.jpeg . I want to add 2 variables to the file name instead of one and make $USER-$DATE.jpeg (rony-23/03/11.jpeg). What is the correct syntax for it as I keep getting errors in the mv as well as rename command. Tried $USER_$DATE or $USER.$DATE etc but no result. Did look up google but it has complex sed scripts.
$ echo $USER-$TERM mehul-xterm $ DATE=`date +%D` echo $USER-$DATE mehul-03/23/11 mehul@ubuntu:~$ touch $USER-$DATE touch: cannot touch `mehul-03/23/11': No such file or directory mehul@ubuntu:~$ mkdir $USER-$DATE mkdir: cannot create directory `mehul-03/23/11': No such file or directory
Maybe the above will help you after you've read Binand's reply.