Reputation: 39
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?
Upvotes: 0
Views: 173
Reputation: 7571
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.
Upvotes: 1