0

I have a shell script like

a="2 3 6"
b="winter summer"
c="model1 model2"

for i in $a;do
 cd "directory_$i"
 sh script.sh
 cd -
done

Where script.sh is

 for j in $b;do
   for k in $c;do
     some computation
   done
 done

When I am running this, it is not executing the script.sh.

fedorqui
  • 275,237
  • 103
  • 548
  • 598
Kay
  • 1,957
  • 2
  • 24
  • 46
  • Try $(/bin/bash script.sh) – dlock May 10 '16 at 08:26
  • Please explain what you want to obtain in more detail... Your code doen not make much sense, as-is... – MarcoS May 10 '16 at 08:27
  • in `script.sh` you are using variables that are set in the first script, so `script.sh` does not know its values. You probably have to pass those as arguments. – fedorqui May 10 '16 at 08:28
  • When you want the results of script.sh in your first script (variables set), you need to `source script.sh`. – Walter A May 10 '16 at 10:01
  • please refer to: http://stackoverflow.com/questions/8352851/how-to-call-shell-script-from-another-shell-script – xuanhai266 May 10 '16 at 10:16

0 Answers0