title: Linux: start a script after another has finished
body: <p>I read the answer for this issue from <a href="https://stackoverflow.com/questions/7485776/start-script-after-another-one-already-running-finishes">this link</a>
  in Stackoverflow.com. But I am so new in writing shell script that I did something wrong. The following are my scripts:</p>
  
  <p>testscript:</p>
  
  <pre><code>#!/bin/csh -f
  pid=$(ps -opid= -C csh testscript1)
  while [ -d /proc/$pid ] ; do
      sleep 1
  done &amp;&amp; csh testscript2
  
  exit
  </code></pre>
  
  <p>testscript1:</p>
  
  <pre><code>#!/bin/csh -f
  /usr/bin/firefox
  exit
  </code></pre>
  
  <p>testscript2:</p>
  
  <pre><code>#!/bin/csh -f
  echo Done
  exit
  </code></pre>
  
  <p>The purpose is for testscript to call testscript1 first; once testscript1 already finish (which means the firefox called in script1 is closed) testscript will call testscript2. However I got this result after running testscript:</p>
  
  <pre><code>$ csh testscript
  Illegal variable name.
  </code></pre>
  
  <p>Please help me with this issue. Thanks ahead.</p>