Moving a bash script to /bin directory

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
2
down vote

favorite












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






share|improve this question

















  • 1




    @Unbesiegbarkeit Is the script expecting some sort of input ? Does it operate on files where it's stored ? If possible, provide a minimal example of what it's supposed to do
    – Sergiy Kolodyazhnyy
    Jun 5 at 15:44






  • 1




    In my /home directory it works, even in /bin it worked at first, but I don't know what has happened.
    – Codito ergo sum
    Jun 5 at 16:00






  • 1




    spd-say is most likely broken and stuck in an endless loop. Out of curiosity why test for "Yes" and not "Qui" instead?
    – WinEunuuchs2Unix
    Jun 5 at 17:46







  • 1




    You mean 'oui'? The script was in french and I modified it for sending it to the site. Then I found that all script is in french( the --language option,etc..). So I put it in french again and I forgot to change that part.
    – Codito ergo sum
    Jun 5 at 17:52







  • 2




    This would be easier to troubleshoot with an MCVE
    – wjandrea
    Jun 5 at 18:11















up vote
2
down vote

favorite












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






share|improve this question

















  • 1




    @Unbesiegbarkeit Is the script expecting some sort of input ? Does it operate on files where it's stored ? If possible, provide a minimal example of what it's supposed to do
    – Sergiy Kolodyazhnyy
    Jun 5 at 15:44






  • 1




    In my /home directory it works, even in /bin it worked at first, but I don't know what has happened.
    – Codito ergo sum
    Jun 5 at 16:00






  • 1




    spd-say is most likely broken and stuck in an endless loop. Out of curiosity why test for "Yes" and not "Qui" instead?
    – WinEunuuchs2Unix
    Jun 5 at 17:46







  • 1




    You mean 'oui'? The script was in french and I modified it for sending it to the site. Then I found that all script is in french( the --language option,etc..). So I put it in french again and I forgot to change that part.
    – Codito ergo sum
    Jun 5 at 17:52







  • 2




    This would be easier to troubleshoot with an MCVE
    – wjandrea
    Jun 5 at 18:11













up vote
2
down vote

favorite









up vote
2
down vote

favorite











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






share|improve this question













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








share|improve this question












share|improve this question




share|improve this question








edited Jun 5 at 19:29
























asked Jun 5 at 15:29









Codito ergo sum

1,077725




1,077725







  • 1




    @Unbesiegbarkeit Is the script expecting some sort of input ? Does it operate on files where it's stored ? If possible, provide a minimal example of what it's supposed to do
    – Sergiy Kolodyazhnyy
    Jun 5 at 15:44






  • 1




    In my /home directory it works, even in /bin it worked at first, but I don't know what has happened.
    – Codito ergo sum
    Jun 5 at 16:00






  • 1




    spd-say is most likely broken and stuck in an endless loop. Out of curiosity why test for "Yes" and not "Qui" instead?
    – WinEunuuchs2Unix
    Jun 5 at 17:46







  • 1




    You mean 'oui'? The script was in french and I modified it for sending it to the site. Then I found that all script is in french( the --language option,etc..). So I put it in french again and I forgot to change that part.
    – Codito ergo sum
    Jun 5 at 17:52







  • 2




    This would be easier to troubleshoot with an MCVE
    – wjandrea
    Jun 5 at 18:11













  • 1




    @Unbesiegbarkeit Is the script expecting some sort of input ? Does it operate on files where it's stored ? If possible, provide a minimal example of what it's supposed to do
    – Sergiy Kolodyazhnyy
    Jun 5 at 15:44






  • 1




    In my /home directory it works, even in /bin it worked at first, but I don't know what has happened.
    – Codito ergo sum
    Jun 5 at 16:00






  • 1




    spd-say is most likely broken and stuck in an endless loop. Out of curiosity why test for "Yes" and not "Qui" instead?
    – WinEunuuchs2Unix
    Jun 5 at 17:46







  • 1




    You mean 'oui'? The script was in french and I modified it for sending it to the site. Then I found that all script is in french( the --language option,etc..). So I put it in french again and I forgot to change that part.
    – Codito ergo sum
    Jun 5 at 17:52







  • 2




    This would be easier to troubleshoot with an MCVE
    – wjandrea
    Jun 5 at 18:11








1




1




@Unbesiegbarkeit Is the script expecting some sort of input ? Does it operate on files where it's stored ? If possible, provide a minimal example of what it's supposed to do
– Sergiy Kolodyazhnyy
Jun 5 at 15:44




@Unbesiegbarkeit Is the script expecting some sort of input ? Does it operate on files where it's stored ? If possible, provide a minimal example of what it's supposed to do
– Sergiy Kolodyazhnyy
Jun 5 at 15:44




1




1




In my /home directory it works, even in /bin it worked at first, but I don't know what has happened.
– Codito ergo sum
Jun 5 at 16:00




In my /home directory it works, even in /bin it worked at first, but I don't know what has happened.
– Codito ergo sum
Jun 5 at 16:00




1




1




spd-say is most likely broken and stuck in an endless loop. Out of curiosity why test for "Yes" and not "Qui" instead?
– WinEunuuchs2Unix
Jun 5 at 17:46





spd-say is most likely broken and stuck in an endless loop. Out of curiosity why test for "Yes" and not "Qui" instead?
– WinEunuuchs2Unix
Jun 5 at 17:46





1




1




You mean 'oui'? The script was in french and I modified it for sending it to the site. Then I found that all script is in french( the --language option,etc..). So I put it in french again and I forgot to change that part.
– Codito ergo sum
Jun 5 at 17:52





You mean 'oui'? The script was in french and I modified it for sending it to the site. Then I found that all script is in french( the --language option,etc..). So I put it in french again and I forgot to change that part.
– Codito ergo sum
Jun 5 at 17:52





2




2




This would be easier to troubleshoot with an MCVE
– wjandrea
Jun 5 at 18:11





This would be easier to troubleshoot with an MCVE
– wjandrea
Jun 5 at 18:11











1 Answer
1






active

oldest

votes

















up vote
1
down vote













I have not enough reputation to make a comment, but it seems to me that you need to put your script in /usr/local/bin.



From man hier(7)




/bin
This directory contains executable programs which are needed in
single user mode and to bring the system up or repair it.

/usr/local/bin
Binaries for programs local to the site.



You know, copy with sudo cp and check the permissions.



But if you want to use the program just for yourself, put in on /home/$USER/bin folder.



Also, you can make a symlink from your script to a path in /usr/local/bin



ln -s /full/path/to/your-script.sh /usr/local/bin/<empty or optional name>


  • How to put executable to /usr/local/bin?

  • Differences between /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin

  • https://unix.stackexchange.com/questions/8656/usr-bin-vs-usr-local-bin-on-linux





share|improve this answer





















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1043845%2fmoving-a-bash-script-to-bin-directory%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    I have not enough reputation to make a comment, but it seems to me that you need to put your script in /usr/local/bin.



    From man hier(7)




    /bin
    This directory contains executable programs which are needed in
    single user mode and to bring the system up or repair it.

    /usr/local/bin
    Binaries for programs local to the site.



    You know, copy with sudo cp and check the permissions.



    But if you want to use the program just for yourself, put in on /home/$USER/bin folder.



    Also, you can make a symlink from your script to a path in /usr/local/bin



    ln -s /full/path/to/your-script.sh /usr/local/bin/<empty or optional name>


    • How to put executable to /usr/local/bin?

    • Differences between /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin

    • https://unix.stackexchange.com/questions/8656/usr-bin-vs-usr-local-bin-on-linux





    share|improve this answer

























      up vote
      1
      down vote













      I have not enough reputation to make a comment, but it seems to me that you need to put your script in /usr/local/bin.



      From man hier(7)




      /bin
      This directory contains executable programs which are needed in
      single user mode and to bring the system up or repair it.

      /usr/local/bin
      Binaries for programs local to the site.



      You know, copy with sudo cp and check the permissions.



      But if you want to use the program just for yourself, put in on /home/$USER/bin folder.



      Also, you can make a symlink from your script to a path in /usr/local/bin



      ln -s /full/path/to/your-script.sh /usr/local/bin/<empty or optional name>


      • How to put executable to /usr/local/bin?

      • Differences between /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin

      • https://unix.stackexchange.com/questions/8656/usr-bin-vs-usr-local-bin-on-linux





      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        I have not enough reputation to make a comment, but it seems to me that you need to put your script in /usr/local/bin.



        From man hier(7)




        /bin
        This directory contains executable programs which are needed in
        single user mode and to bring the system up or repair it.

        /usr/local/bin
        Binaries for programs local to the site.



        You know, copy with sudo cp and check the permissions.



        But if you want to use the program just for yourself, put in on /home/$USER/bin folder.



        Also, you can make a symlink from your script to a path in /usr/local/bin



        ln -s /full/path/to/your-script.sh /usr/local/bin/<empty or optional name>


        • How to put executable to /usr/local/bin?

        • Differences between /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin

        • https://unix.stackexchange.com/questions/8656/usr-bin-vs-usr-local-bin-on-linux





        share|improve this answer













        I have not enough reputation to make a comment, but it seems to me that you need to put your script in /usr/local/bin.



        From man hier(7)




        /bin
        This directory contains executable programs which are needed in
        single user mode and to bring the system up or repair it.

        /usr/local/bin
        Binaries for programs local to the site.



        You know, copy with sudo cp and check the permissions.



        But if you want to use the program just for yourself, put in on /home/$USER/bin folder.



        Also, you can make a symlink from your script to a path in /usr/local/bin



        ln -s /full/path/to/your-script.sh /usr/local/bin/<empty or optional name>


        • How to put executable to /usr/local/bin?

        • Differences between /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin

        • https://unix.stackexchange.com/questions/8656/usr-bin-vs-usr-local-bin-on-linux






        share|improve this answer













        share|improve this answer



        share|improve this answer











        answered Jul 25 at 13:25









        mrc_es

        414




        414






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1043845%2fmoving-a-bash-script-to-bin-directory%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

            Trouble downloading packages list due to a “Hash sum mismatch” error

            How do I move numbers in filenames, in a batch renaming operation?