0

In a bash shell script I would like to do the following:

for file in /path/to/original/*
  nfcapd -p 12345 -l /path/to/new/file/ -x 'mv %d%f %d/$file'
done

So nfcapd -x lets you add a command to execute on completion. I want to mv %d%f (move directorypath/defaultfilename) to %d/$file (directorypath/original_file_name). Unfortunately, this is saving the new file as "$file" not the value of the $file variable. Is there a way to escape the quotes?

1 Answer 1

1

Use double quotes instead of single quotes around the argument to -x, it will be:

nfcapd -p 12345 -l /path/to/new/file/ -x "mv %d%f %d/$file"

Shell variables are not expanded inside single quotes.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.