how to do this........... is it possible ???


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how to do this........... is it possible ???
# 1  
Old 11-02-2007
how to do this........... is it possible ???

hi

i have a variable called vara="(" i need to use this in a if condition like this..
vara="("
echo "$vara"
if ["$vara" = "(" ]
then
echo "yes"
else
echo "no"
fi
but this does not work andgives me the error
test: argument expected
any solution for this?
# 2  
Old 11-02-2007
Code:
vara="("
echo "$vara"
if [ "\$vara" = "\(" ]
  then
    echo "yes"
  else
    echo "no"
fi

Hope that helps you out.

Cheers,
Cam
# 3  
Old 11-02-2007
hi
yeah it enters into the "no" .. but does not recognise..

+ [ $vara = \( ]

this is how it checks for the condition.. any idea as to how it goes???
# 4  
Old 11-02-2007
I do appologize, my head isn't on straight this evening. Smilie

Replace the incorrect line above with this..
if [ \\"$vara" = "\(" ]
Cheers,
Cam
# 5  
Old 11-02-2007
thank u so much
:-)
# 6  
Old 11-02-2007
No problem, just glad to achieve something this evening. Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question