b4udv8
1
bash version 4.3.48(1)-release (i686-pc-linux-gnu)
ubuntu MATE 16.04 LTS
why will this not work?
#1/bin/bash
history -c && history -w
exit
vim’d the script as ch.sh (for ‘clear history’)
placed in pat ~/bin/ch.sh
chmod -x ch.sh
still get command not found
Hi @b4udv8, A few possibilities.
-
chmod **+**x (you have -x). Most likely.
-
1/bin/bash may be a typo and formatting here can hinder but should be…
#!/bin/bash
- Be sure and login with ~/bin so it gets in $PATH. Newly created it will not be in $PATH until logout/login or reboot.
HTH
elcste
3
Are you trying to run the command as ch.sh
or just ch
(which won’t work)? (This was an early error I made.)
b4udv8
4
I tried first as just ch with command not found. Then tried it as ch.sh with the same results.
As far as $PATH, it lists /home/b4udv8/bin which I also moved ch.sh shell
to, but same results.
Please see - https://en.wikipedia.org/wiki/Shebang_(Unix)
Did you correct the typo in your command? Just curious…
b4udv8
6
Yes I fixed the typo (it was actually typed wrong in my post).
Now when I execute ‘ch’ it just returns to the command prompt.