csh does the loops in order, the problem is that you are using exec, which replaces the current program (which is the shell) with another, in the same process. Since others have provided sh versions, here is csh:
#! / bin / csh
set i = 11
while ($ i & lt 25)
tar xzf "myfile-1.0. $ i"
# detect an error was returned by the script
if ({./patch.sh}) then
echo "Patching to $ i failed"
endif
@ i = $ i + 1
end
Not sure about ./patch.sh
, are you checking its existence or running it? I run it here and check the result - true means that it returns zero. As an alternative:
# detect an error was returned by the script
if (! {tar xzf "myfile-1.0. $ i"}) then
echo "Patching to $ i failed"
endif
cdarke
source share