really simple Shell scripting help needed

Associate
Joined
4 Aug 2009
Posts
187
Hello all

I just dont understand this anymore, maybe its just late or something but this is killing me. Whats wrong with this?

Code:
      dirname=${fspec#/}
      dirname=${dirname%/*}
      echo "$dirname" >&2
      if [ $dirname != $previousdir ]; then
        echo "YESSSSSSSSSSSSS" >&2
      else
        echo "Allready done" >&2
      fi
      previousdir=$dirname

The if statement is giving me this error line 225 is that if statement. If i remove it the code works fine.

Code:
line 225: [: too many arguments

Thanks!
 
Got it working with :

Code:
      [ "$prevdir" != "$currentdir" ]
      if [ $? == 0 ]; then

The -ne only works for Ints I believe.

Chers anyways
 
Back
Top Bottom