I'm a newbie to Unix shell scripts, and can't understand why this doesn't work as the individual commands do on on the command line. Apologies if its obvious.
I am trying to build a script with some Unix commands, and call it using sh script.sh in Putty. Here is a sample:
echo Carrying out compression
gzip -c file_1.csv > file_1.csv.gz
gzip -c file_2.csv > file_2.csv.gz
gzip -c file_3.csv > file_3.csv.gz
Rather than producing the specified named output, I am getting very weird named files eg. FTY4WG~7. That is except for the last one which is named correctly.
If I put a space after each line, it works but I get an error message: : No such file or directory
Actually I'm trying to do a whole bunch of stuff (stitching together CSVs as well as compressing them), but if I can crack this simple command I'll probably be able to work it all out.
Thanks for your help!
Ben