Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here is my command in my script:

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

Right now the output is:


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.

share|improve this question
up vote 2 down vote accepted

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)
share|improve this answer
Backticks are deprecated. You should use capture shells instead. – Evan Teitelman Jul 11 '13 at 20:56

You can also do it like this:

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.