Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Cp command not working as expected in HPUX

$
0
0
Hi, I'm having trouble with a simple copy command in a script on HPUX.

I am trying to copy a file and append date & time.

The echo command prints out what I am expecting..

Code:

echo "Backing up $file to $file.$DATE.$FIXNUM" | tee -a $LOGFILE

+ echo 'Backing up /home/efin/gp/source/kerf/verlist.pc to /home/efin/gp/source/kerf/verlist.pc.20150602.12345'

However, the copy copies the filename to $DATE.FIXNUM ..

Code:

cp $file $file_$DATE.$FIXNUM | tee -a $LOGFILE
+ cp /home/efin/gp/source/kerf/verlist.pc 20150602.12345

Thanks in advance

Viewing all articles
Browse latest Browse all 16232

Trending Articles