I am trying to transfer a file with a date variable embedded in the destination filename. The variable is created with the statement IDATE="`date +%Y%m%d`"
When I attempt the transfer with the command put //DD:FILE1 file1_email_$IDATE.txt, the file is created on the destination server with the filename file1_email_20111017.txt, which is what I expect. However, if I attempt to transfer the file using the command put //DD:FILE1 file1_$IDATE_email.txt, a file is created on the destination server with the filename file1_.txt. This is not what I expect. Is there a command that will create a file named file1_20111017_email.txt?
Date in destination filename
Re: Date in destination filename
Greg,
You'll need to wrap braces {} around your shell variable name:
If you don't do this, the shell will match the longest possible name for the variable, even if it isn't defined. In your case, this would be "IDATE_email".
--Steve
You'll need to wrap braces {} around your shell variable name:
Code: Select all
//DD:FILE1 file1_${IDATE}_email.txt
--Steve