Quote:
Originally Posted by
cburgoyne
# get filename without extension
fileName=$(getFileName $1 'yes')
new_name=`awk -F"_" '{print $5}' $fileName`
CampaignId=`awk -F"_" '{print $3}' $fileName
# move file
createDir "//Web1/Proofs/$CampaignId"
1. If you strip filename off its extension by providing "yes" as a parameter to getFileName, then which file are the next awk statements processing? For e.g., Suppose $1 contains "/home/user/test.dat". If you were to do this:
fileName=$(getFileName $1 'yes'), $fileName would contain simply "test" and not "test.dat". Do you want your awk statements to process "test" or "test.dat"?
2. Second awk statement has a missing closing backtick.
3. In your main script, there's a condition to check if [ $# -ne 2 ], but I don't see $2 being used anywhere.
4. Also, in
createDir "//Web1/Proofs/$CampaignId", the two forward slashes (
//Web1) appears to be a typo-error. First slash not required.
---------- Post updated at 06:04 ---------- Previous update was at 05:53 ----------
I just saw another related post:
https://www.unix.com/unix-dummies-que...wk-script.html
Try using the getFileName function without second parameter - 'yes'. Anyway, its optional from the way its coded in common.sh.lib