Thread: changing dir
View Single Post

  #2 (permalink)  
Old 03-28-2006, 06:42 PM
tom tom is offline
Contributors
User
 
Join Date: Jun 2005
Location: London, UK
Posts: 213
Rep Power: 4
tom is on a distinguished road
Default

You are using == operator which is for string comparison and not for number comparison. Use –eq for equal to. In short,

Code:
if [ $choice -eq 0 ]; then
   cd /home/0
elif [ $choice -eq 1 ]; then
     cd /home/1
else
      echo "Etc etc"
fi
Reply With Quote