I have this script with name example.sh.
echo Write a number, please:
read x
let res=$x+1
echo $res
If i run it this way, I get an error:
mario@gazpatxo-linux:~/temp$ sudo ./example.sh
[sudo] contraseña para mario:
Write a number, please:
3
./example.sh: 3: ./example.sh: let: not found
If i run it this other way, I don't get an error:
mario@gazpatxo-linux:~/temp$ sudo su
root@gazpatxo-linux:/home/mario/temp# ./example.sh
Write a number, please:
4
5
In the second default run I use / bin / bash, which is root's default shell, so it works correctly, but what happens in the first run? What shell am i using? Where can i change it?
Thanks a lot!
env
, beingSHELL=/bin/bash
. I upvoted your question and also up'd @steeldriver 's comment.