1

Here is my command in my script:

mv -f -v $oldfile /infanass/dev/admin/backup/${oldfile##*/}_$(date +%F-%T) 

Right now the output is:

file1.txt_2013-07-11-15:08:16 

I want the server name to show up before the file name. I think :

uname -n 

is the right command but i just can't get it to show up.

2 Answers 2

2

You need to use backticks (`) before and after uname -n to insert the output of this command.

This should do it:

mv -f -v $oldfile /infanass/dev/admin/backup/\`uname -n\`${oldfile##*/}_$(date +%F-%T) 
1
  • 2
    Backticks are deprecated. You should use capture shells instead. Commented Jul 11, 2013 at 20:56
1

You can also do it like this:

$ mv -f -v $oldfile /infanass/dev/admin/backup/$(uname -n)${oldfile##*/}_$(date +%F-%T) 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.