LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   mv command with timestamps not working on expected (https://www.linuxquestions.org/questions/linux-newbie-8/mv-command-with-timestamps-not-working-on-expected-4175525083/)

apss_evaluator 11-11-2014 10:33 AM

mv command with timestamps not working on expected
 
Hi Linux Guru's
I was trying a lot of variety to include on my script on moving files with timestamps but I get the wrong output


I used this:
mv /var/tmp/pogi_install_note /var/tmp/pogi_install_note.`date +%F-%H%M%S`


but got this

[root@pogi ~]# ls -ltrh /var/tmp/pogi*
-rwxrwxrwx 1 root root 81 Nov 11 03:57 /var/tmp/pogi_install_note.file.file-035756OURCE
-rwxrwxrwx 1 root root 81 Nov 11 04:35 /var/tmp/pogi_install_note.file.file-043527OURCE
-rwxrwxrwx 1 root root 81 Nov 11 05:05 /var/tmp/pogi_install_note.file.file-050529OURCE
-rwxrwxrwx 1 root root 81 Nov 11 06:19 /var/tmp/pogi_install_note.file.file-061943OURCE

haertig 11-11-2014 11:03 AM

Hmmm. Your command worked just fine for me. Don't know what's different about your system.

Code:

$ ls
$ > xyz
$ mv xyz xyz.`date +%F-%H%M%S`
$ ls
xyz.2014-11-11-100240
$


AnanthaP 11-11-2014 11:29 PM

Looks like it's not issued from the command line but from within a text editor that has some smart substitution. (file.file for the -f and SOURCE for the -s).

OK


All times are GMT -5. The time now is 11:22 AM.