[Edit - Save your time. Better rendering of the situation at this entry]
I've got a script with a shebang that works on Ubuntu Mate, but not on Lubuntu Minimal (+LXDE).
I can't quite get what I need from searches, and I'm now overwhelmed.
My first (ever!) script, written on my host Ubuntu Mate (xenial) machine, worked beautifully easily. That version is at the end of this post.
I took the same script to my VM Lubuntu Minimal machine, (rewrote it manually - no sharing), and ran into trouble.
In Lubuntu Minimal I've tried the following shebangs, gleaned from various forums:
#!/bin/bash works fine in the host
which yield (mostly):
bash: /home/user/bin/script1: [the path part of the shebang, e.g./bin/bash/]: bad interpreter: not a directory
I've restarted the machine once or twice, and used
chmod +x and
chmod 700 - checking with 'ls -l' shows the same permissions as the working version on Ubuntu Mate.
I've tried naming the script
script1.sh as well as just
script1. I've called it using
/.script1.sh, to no result. (I don't know what these
sh exactly do, nor for what process).
I've placed the script file in:
/usr/local/bin (which I think I had to create, from memory)
~/Desktop just to see
~/bin (and I did indeed have to create this)
Some forum talked about
$PATH and rebooting, so I've rebooted a couple of times (but I don't understand
The only (partial) success comes from removing the shebang and saving that script in
I just can't understand why. What critical thing is missing from Lubuntu Minimal that Ubuntu Mate has? If I just create, say a `/bin/bash' directory, will bash magically find its way there, do nothing, or will I break it?
Ultimately, I want this to run from a
.desktoplauncher, but initial experiments fail - using
Exec=script1in the desktop entry makes a terminal window flash up then close, instantly. Previously I've used
bash -c "cmd1 && cmd2 &&..."in Lubuntu, but bash is throwing an error here. Intuitively, I guess that's because I removed 'bash' from the shebang, but see problem 1., above.
My head is now pretty tangled, and I'm not sure where to start reading to get on top of this. Your wisdom would be appreciated.
Thanks in advance
Original test script (works in Ubuntu Mate):
#!/bin/bash #host to block echo -e "enter domain to block:" read host_name host_entry="127.0.1.1\t$host_name" echo -e $host_entry >>/home/user/Desktop/host-edits-test echo "***done and gone***" sleep 2 exit 0