I have a bash script named Script.sh . It worked well when it was in my /home directory.I moved it to my /bin directory,for running it as command. At first it worked well(as a command, in my /bin), but after restarting, it stopped working. When I type Script.sh
, in terminal, nothing happens and I have to use Ctrl+C
for getting the terminal to work again. When my Script.sh is in my /bin, my spd-say
command doesn't work either(it does not pronounce the argument when I use it in terminal). After moving the script from /bin, everything gets corrected. Is there any problem, moving a file to /bin?
$ echo $PATH
:/home/m/bin:/home/m/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
This is the first part of the script.
#!/bin/bash
spd-say -w "Do you know this man?"
xdg-open $(locate "X.jpg")
read a
if [ "$a" == "yes" ]
then
spd-say -w "Call the police."
else
spd-say -w "Thanks."
fi
spd-say
from the command line didn’t work when you hadScript.sh
in/bin/
? – dessert Jun 05 '18 at 16:07spd-say
is most likely broken and stuck in an endless loop. Out of curiosity why test for "Yes" and not "Qui" instead? – WinEunuuchs2Unix Jun 05 '18 at 17:46:
). Maybe that's related? – wjandrea Jun 05 '18 at 18:09/bin/
, did you mean you moved it to~/bin/
? There is a big difference. The script should be in/home/$USER/bin/
, not/bin/
. – user68186 Jun 05 '18 at 19:03ls -a | grep bin
nothing shows up in my PC and I don't see such file there in my /home directory. Anyway, what happens if I put it in /bin ? (The bin in my root directory I mean.) The same directory where commands like ls are there? – Jun 05 '18 at 19:16pgrep spd-say
? Does it return a pid? – muclux Jun 07 '18 at 17:35spd-say
does not work in any terminal. Anyway I forgot putting the script there. Thanx. – Jun 07 '18 at 17:43