./script: line 1: #!/bin/bash: No such file or directory enter ip
>>> : 10.000
10.00 0 ./script: line 8: [0!=.]: command not found ./script: line 13: =: command not found
скрипт
#!/bin/bash
var="0/24"
echo "enter ip"
read -p ">>> : " ipaddr
echo ${temp}
echo ${ipaddr%?} #display whole string except last character
echo ${ipaddr:(-1)} #display last character in string
while [${ipaddr:(-1)}!="."] #loop till ${ipaddr} last == "."
do
${cur} = ${ipaddr::-1}
echo $cur
done #remove last char if != "."
$temp = ${ipaddr}${var} #add string ${var} to end of ${ipaddr}
echo ${temp}