Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!asuvax!ncar!tank!eecae!cps3xx!usenet From: usenet@cps3xx.UUCP (Usenet file owner) Newsgroups: comp.os.minix Subject: shell script in MINIX 1.2 Keywords: MINIX1.2, shell, script Message-ID: <5486@cps3xx.UUCP> Date: 22 Nov 89 15:39:36 GMT Expires: 6 Dec 89 05:00:00 GMT References: none Reply-To: rattan@frith.egr.msu.edu () Distribution: na Organization: Michigan State University Lines: 26 I am using MINIX 1.2 to teach the OS course and a student wrote the following script which does not terminate. I can not figure out why? Any ideas will be appreciated. 1 #script to find the path to a command 2 #usage: where 3 # 4 if test $# -ne 1; then 5 echo "Usage: $0 6 exit 1 7 fi 8 9 dir="/bin /usr/bin" 10 for d in $dir; do 11 list="`ls $d`" 12 for name in $list; do 13 if test $1 = $name; then 14 echo $d/$name 15 fi 16 done 17 done 18 exit 0 If one puts an echo "" between lines 16 and 17 it works correctly. -ir (rattan@frith.egr.msu.edu)