开发者

Linux bash thing

开发者 https://www.devze.com 2023-02-05 00:27 出处:网络
I try to create a little bash script, with which I have no experience. I try to do 开发者_C百科something like:

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

精彩评论

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