I am getting confused about Linux shells. It may be that I oversee something obvious as a Linux noob.
All I want is the following script to run:
#!/bin/bash echo "Type some Text:" read var echo "You entered: "$var
Here is the situation:
- Installed Ubuntu Server 14.04 in a VirtualBox on windows
- Installed it with this packages
- A SAMBA mounted on /media/buff
- The script is on /media/buff/ShellScript/test.sh
- made executable by "sudo chmod a+x /media/buff/ShellScript/test.sh"
- The rest is default
- I am using PSPad on windows to edit the script file
I read about the dash but I'm not getting it. Here are some variations:
Using sh to launch
user@Ubuntu:/media/buff/ShellScript$ sh test.sh Type some Text: :bad variable nameread var You entered:
Using bash to launch:
user@Ubuntu:/media/buff/ShellScript$ bash test.sh Type some Text: ': Ist kein gültiger Bezeichner.var (means no valid identifyier) You entered:
Changed the Shebang in the script to "#!/bin/sh", Using sh to launch
user@Ubuntu:/media/buff/ShellScript$ sh test.sh Type some Text: :bad variable nameread var You entered:
I searched across the Internet for hours now and I assume, that the script itself is ok, but there are missing some environment settings. I used "sudo dpkg-reconfigure dash" to set dash as default shell (which I think is ubuntu default anyway)
sadface panda :)