Hi All!!
I am having trouble in executing the following command into a c-shell script.
mv "$file" "$(head -1 "$file")"
The funny thing is that the same command works perfectly from the command line, but when incorporated into a "foreach loop" of a c-shell script, it shows an error - Illegal Variable Name.
Could you please help??
Thanks,
Po
other than the standard suggestion that you should not use csh....
ls wibble
wibble: No such file or directory
% echo wibble>testfile
% set file = testfile
% echo $file
testfile
% mv "$file" "$(head -1 "$file")"
Variable syntax
s% mv "$file" "`head -1 "$file"`"
% ls wib*
wibble
What OS are you using...
And post a larger fragment of your code so we can see it in context..
What is the overall aim of your code; i.e. what is the full task you are trying to accomplish.
cheers