开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜