crp Posted April 25, 2014 Share Posted April 25, 2014 (edited) mDoW="`date | cut -c 1-3`" mkdir /home/bu_files/$mDoW/ find /mnt/SAC/* -mtime -1 | awk '{print "cp " "\"$_"\" " /home/bu_files/"$mDoW}' results in awk: line 1: runaway string constant "$mDoW} ... Anyone know how to fix it? using Debian Whiskey. Edited April 25, 2014 by crp Quote Link to comment Share on other sites More sharing options...
ebrke Posted April 25, 2014 Share Posted April 25, 2014 Does this link help at all: http://www.gnu.org/software/gawk/manual/html_node/Using-Shell-Variables.html My own shell scripting days are 10+ years in the past, unfortunately. Quote Link to comment Share on other sites More sharing options...
jimg Posted April 26, 2014 Share Posted April 26, 2014 What are you trying to accomplish with your script? You can the get the day of the week from date without using cut: mDow=$(date +%a) echo $mDow Sat 1 Quote Link to comment Share on other sites More sharing options...
crp Posted April 27, 2014 Author Share Posted April 27, 2014 What are you trying to accomplish with your script? You can the get the day of the week from date without using cut: mDow=$(date +%a) echo $mDow Sat copy new files from today to a directory with the day's name as part of the directory name.This is simple enough in the DOS world with xcopy but I can't find an equivalent in Linux. My quote marks seem to be aligned properly but the macro expansions are not functioning. Quote Link to comment Share on other sites More sharing options...
crp Posted April 29, 2014 Author Share Posted April 29, 2014 I gave up on it, after a lot of toil came up with find /mnt/SAC/* -type f -mtime -1 -exec cp -u -v -b -p --parents {} /home/bu_files/_$mDoW/ \; 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.