Thanks for the reply. No disrespect, but your suggestion kinda screwed me over. Putting my commands in the quotations deleted all my data files. Fortunately I backed them up beforehand. I ended up using your suggestion for the quotes (thanks for that), but I put all the stuff from inside the quotes in another script and run it that way. It worked.
I have no idea how did I manage to erase everything, and actually, I'd appreciate if someone could explain to me what went wrong.
This is what happened: I have 20 directories called
anneal_1 to anneal_20. Each one has different number of data files called si.001 to si.0** (stars are some nubers). I needed to pick up an si.0** file (from each anneal_* directory) that has the highest number in its name, and then execute simulation on that file. So this is the beginning of the unsuccesfull script - the part that messed me up:
for i in `seq 1 20`
rsh node10 "
for j in anneal_$i/si.0*
if [ $j > $max ]
... " #rest of the simulation run on the node10
I get the error message
bash: line 8: [: missing `]'
twenty times. After that, all the files si.0** were empty except for the highest-numbered one, and get this: an empty file with the name " ] " showed up in the directory where script is executed (!?!?). How that happened is a great mistery to me
. Some weird redirection was done by the '>' character. Actually, without the quotation marks that I use to submit job to the execution node, it works as it's supposed to.