Small problem with bash and forward slash
Hi,
I have a script that grabs a numerical string from a text file that sometimes can be several slashes which in that case should have a certain action. So: tm=2 if [ tm="/" ] then res=0 else res=1 fi This always gives me res = 0. What do I have to do so it gives me res = 1? I tried several ways in the IF like escaping the forward slash but that condition is always true. Thanks. |
You need some spaces around that equals sign. And in general you should use [[ ]].
Code:
tm=2 |
Thanks a lot!
|
I have another related question if you don't mind. :p
So: Code:
nr=1 |
Oops! I had a typo in my previous post. I've emitted that post but here it is again:
Code:
tm=2 |
Everything working fine now. Thanks!
|
All times are GMT -5. The time now is 02:04 PM. |