Linux bash thing
I try to create a little bash script, with which I have no experience. I try to do 开发者_C百科something like:
#!/bin/bash
statut="na"
if [ $proc = 0 ]; then
statut = "closed"
else
statut = "opened"
fi
but I receive: ./test.sh: line 4: statut: command not found Can you give me a hint? On Google I couldn't find something similar. All if examples are with echo not with variable assignation. Thank you!
That's because you're not following a syntax for assignment operator - you should remove spaces around '=' (and quote $proc):
#!/bin/bash
statut="na"
if [ "$proc" = 0 ]; then
statut="closed"
else
statut="opened"
fi
精彩评论