How do I use chmod to make .sh files executable? [duplicate]












0















This question already has an answer here:




  • How to create & execute a script file [duplicate]

    1 answer




My touch overlay is failing to respond in portrait but in landscape I got to a page where I am able to rotate touch input so that it can work in portrait (using this advice on Ubuntu Forums), so I have to make the .sh scripts and run them. I am working with shell scripts for the first time and I am using the ones on this page and it asked me not to forget to set chmod to execute for .sh files using this code:



chmod 777 *.sh









share|improve this question















marked as duplicate by Kulfy, Zanna, Charles Green, Elder Geek, guntbert Dec 20 at 22:11


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











  • 2




    Please don't use 777, use 755 or just chmod a+x instead. That said, what is your question? Do you need help running that command? Do you know how to open a terminal? Please edit your question and explain what part of this is giving you trouble.
    – terdon
    Nov 8 at 19:04












  • Also, * is a wildcard which means if you use *.sh, all files with extension as sh in current folder will be effected.
    – Kulfy
    Nov 8 at 19:09
















0















This question already has an answer here:




  • How to create & execute a script file [duplicate]

    1 answer




My touch overlay is failing to respond in portrait but in landscape I got to a page where I am able to rotate touch input so that it can work in portrait (using this advice on Ubuntu Forums), so I have to make the .sh scripts and run them. I am working with shell scripts for the first time and I am using the ones on this page and it asked me not to forget to set chmod to execute for .sh files using this code:



chmod 777 *.sh









share|improve this question















marked as duplicate by Kulfy, Zanna, Charles Green, Elder Geek, guntbert Dec 20 at 22:11


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











  • 2




    Please don't use 777, use 755 or just chmod a+x instead. That said, what is your question? Do you need help running that command? Do you know how to open a terminal? Please edit your question and explain what part of this is giving you trouble.
    – terdon
    Nov 8 at 19:04












  • Also, * is a wildcard which means if you use *.sh, all files with extension as sh in current folder will be effected.
    – Kulfy
    Nov 8 at 19:09














0












0








0








This question already has an answer here:




  • How to create & execute a script file [duplicate]

    1 answer




My touch overlay is failing to respond in portrait but in landscape I got to a page where I am able to rotate touch input so that it can work in portrait (using this advice on Ubuntu Forums), so I have to make the .sh scripts and run them. I am working with shell scripts for the first time and I am using the ones on this page and it asked me not to forget to set chmod to execute for .sh files using this code:



chmod 777 *.sh









share|improve this question
















This question already has an answer here:




  • How to create & execute a script file [duplicate]

    1 answer




My touch overlay is failing to respond in portrait but in landscape I got to a page where I am able to rotate touch input so that it can work in portrait (using this advice on Ubuntu Forums), so I have to make the .sh scripts and run them. I am working with shell scripts for the first time and I am using the ones on this page and it asked me not to forget to set chmod to execute for .sh files using this code:



chmod 777 *.sh




This question already has an answer here:




  • How to create & execute a script file [duplicate]

    1 answer








16.04 scripts chmod






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 20 at 10:57









Zanna

50k13131238




50k13131238










asked Nov 8 at 18:45









Kayz5ive

95




95




marked as duplicate by Kulfy, Zanna, Charles Green, Elder Geek, guntbert Dec 20 at 22:11


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by Kulfy, Zanna, Charles Green, Elder Geek, guntbert Dec 20 at 22:11


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 2




    Please don't use 777, use 755 or just chmod a+x instead. That said, what is your question? Do you need help running that command? Do you know how to open a terminal? Please edit your question and explain what part of this is giving you trouble.
    – terdon
    Nov 8 at 19:04












  • Also, * is a wildcard which means if you use *.sh, all files with extension as sh in current folder will be effected.
    – Kulfy
    Nov 8 at 19:09














  • 2




    Please don't use 777, use 755 or just chmod a+x instead. That said, what is your question? Do you need help running that command? Do you know how to open a terminal? Please edit your question and explain what part of this is giving you trouble.
    – terdon
    Nov 8 at 19:04












  • Also, * is a wildcard which means if you use *.sh, all files with extension as sh in current folder will be effected.
    – Kulfy
    Nov 8 at 19:09








2




2




Please don't use 777, use 755 or just chmod a+x instead. That said, what is your question? Do you need help running that command? Do you know how to open a terminal? Please edit your question and explain what part of this is giving you trouble.
– terdon
Nov 8 at 19:04






Please don't use 777, use 755 or just chmod a+x instead. That said, what is your question? Do you need help running that command? Do you know how to open a terminal? Please edit your question and explain what part of this is giving you trouble.
– terdon
Nov 8 at 19:04














Also, * is a wildcard which means if you use *.sh, all files with extension as sh in current folder will be effected.
– Kulfy
Nov 8 at 19:09




Also, * is a wildcard which means if you use *.sh, all files with extension as sh in current folder will be effected.
– Kulfy
Nov 8 at 19:09










3 Answers
3






active

oldest

votes


















2















  1. Easy way in Kubuntu (Ubuntu is the same). Properties of sh file that you need to change.


solutionOne





  1. Just open a terminal and go into the folder where you handle the .sh file (like mine below), and run chmod a+x foo.sh where foo.sh is the name of the script.



    cd /path/to/script/directory
    chmod a+x foo.sh







share|improve this answer































    1














    The way question sounds is "How do I automate making .sh files ( or scripts in general ) executable?" And the answer is that you can't without changing the default permissions for newly created files. That's done via umask. The .sh files aren't special, they're just text files at very basic level. But of course you don't want to change umask to give executable permission to any random text file that's been just created, because you're opening a Pandora's box of security holes for yourself.



    So the answer is you can't automate that without unreasonable security hole. Better approach is just to get into habits of running chmod yourself or running scripts as argument to appropriate interpreter such as bash foo.sh. Or make a shell function to call your favorite text editor to create a file and then chmod, for instance



    makesh(){
    for i; do
    vi "$i"
    chmod +x "$i"
    done
    }


    I know this answer isn't pretty of fun, but it's practical






    share|improve this answer































      -1














      Navigate to the folder where the file is using cd.



      Run the following command:



      chmod a+x FILENAME.sh



      Hope that helps.






      share|improve this answer

















      • 1




        This seems to be a duplicate answer.
        – Kulfy
        Nov 8 at 19:10










      • The answer above mine was taking a different approach earlier. Sorry for the mix up. 😅
        – Qumber Rizvi
        Nov 8 at 19:13


















      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2















      1. Easy way in Kubuntu (Ubuntu is the same). Properties of sh file that you need to change.


      solutionOne





      1. Just open a terminal and go into the folder where you handle the .sh file (like mine below), and run chmod a+x foo.sh where foo.sh is the name of the script.



        cd /path/to/script/directory
        chmod a+x foo.sh







      share|improve this answer




























        2















        1. Easy way in Kubuntu (Ubuntu is the same). Properties of sh file that you need to change.


        solutionOne





        1. Just open a terminal and go into the folder where you handle the .sh file (like mine below), and run chmod a+x foo.sh where foo.sh is the name of the script.



          cd /path/to/script/directory
          chmod a+x foo.sh







        share|improve this answer


























          2












          2








          2







          1. Easy way in Kubuntu (Ubuntu is the same). Properties of sh file that you need to change.


          solutionOne





          1. Just open a terminal and go into the folder where you handle the .sh file (like mine below), and run chmod a+x foo.sh where foo.sh is the name of the script.



            cd /path/to/script/directory
            chmod a+x foo.sh







          share|improve this answer















          1. Easy way in Kubuntu (Ubuntu is the same). Properties of sh file that you need to change.


          solutionOne





          1. Just open a terminal and go into the folder where you handle the .sh file (like mine below), and run chmod a+x foo.sh where foo.sh is the name of the script.



            cd /path/to/script/directory
            chmod a+x foo.sh








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 8 at 19:03









          terdon

          64.2k12136212




          64.2k12136212










          answered Nov 8 at 18:56









          peanek

          212




          212

























              1














              The way question sounds is "How do I automate making .sh files ( or scripts in general ) executable?" And the answer is that you can't without changing the default permissions for newly created files. That's done via umask. The .sh files aren't special, they're just text files at very basic level. But of course you don't want to change umask to give executable permission to any random text file that's been just created, because you're opening a Pandora's box of security holes for yourself.



              So the answer is you can't automate that without unreasonable security hole. Better approach is just to get into habits of running chmod yourself or running scripts as argument to appropriate interpreter such as bash foo.sh. Or make a shell function to call your favorite text editor to create a file and then chmod, for instance



              makesh(){
              for i; do
              vi "$i"
              chmod +x "$i"
              done
              }


              I know this answer isn't pretty of fun, but it's practical






              share|improve this answer




























                1














                The way question sounds is "How do I automate making .sh files ( or scripts in general ) executable?" And the answer is that you can't without changing the default permissions for newly created files. That's done via umask. The .sh files aren't special, they're just text files at very basic level. But of course you don't want to change umask to give executable permission to any random text file that's been just created, because you're opening a Pandora's box of security holes for yourself.



                So the answer is you can't automate that without unreasonable security hole. Better approach is just to get into habits of running chmod yourself or running scripts as argument to appropriate interpreter such as bash foo.sh. Or make a shell function to call your favorite text editor to create a file and then chmod, for instance



                makesh(){
                for i; do
                vi "$i"
                chmod +x "$i"
                done
                }


                I know this answer isn't pretty of fun, but it's practical






                share|improve this answer


























                  1












                  1








                  1






                  The way question sounds is "How do I automate making .sh files ( or scripts in general ) executable?" And the answer is that you can't without changing the default permissions for newly created files. That's done via umask. The .sh files aren't special, they're just text files at very basic level. But of course you don't want to change umask to give executable permission to any random text file that's been just created, because you're opening a Pandora's box of security holes for yourself.



                  So the answer is you can't automate that without unreasonable security hole. Better approach is just to get into habits of running chmod yourself or running scripts as argument to appropriate interpreter such as bash foo.sh. Or make a shell function to call your favorite text editor to create a file and then chmod, for instance



                  makesh(){
                  for i; do
                  vi "$i"
                  chmod +x "$i"
                  done
                  }


                  I know this answer isn't pretty of fun, but it's practical






                  share|improve this answer














                  The way question sounds is "How do I automate making .sh files ( or scripts in general ) executable?" And the answer is that you can't without changing the default permissions for newly created files. That's done via umask. The .sh files aren't special, they're just text files at very basic level. But of course you don't want to change umask to give executable permission to any random text file that's been just created, because you're opening a Pandora's box of security holes for yourself.



                  So the answer is you can't automate that without unreasonable security hole. Better approach is just to get into habits of running chmod yourself or running scripts as argument to appropriate interpreter such as bash foo.sh. Or make a shell function to call your favorite text editor to create a file and then chmod, for instance



                  makesh(){
                  for i; do
                  vi "$i"
                  chmod +x "$i"
                  done
                  }


                  I know this answer isn't pretty of fun, but it's practical







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 8 at 19:28

























                  answered Nov 8 at 19:22









                  Sergiy Kolodyazhnyy

                  69.3k9144304




                  69.3k9144304























                      -1














                      Navigate to the folder where the file is using cd.



                      Run the following command:



                      chmod a+x FILENAME.sh



                      Hope that helps.






                      share|improve this answer

















                      • 1




                        This seems to be a duplicate answer.
                        – Kulfy
                        Nov 8 at 19:10










                      • The answer above mine was taking a different approach earlier. Sorry for the mix up. 😅
                        – Qumber Rizvi
                        Nov 8 at 19:13
















                      -1














                      Navigate to the folder where the file is using cd.



                      Run the following command:



                      chmod a+x FILENAME.sh



                      Hope that helps.






                      share|improve this answer

















                      • 1




                        This seems to be a duplicate answer.
                        – Kulfy
                        Nov 8 at 19:10










                      • The answer above mine was taking a different approach earlier. Sorry for the mix up. 😅
                        – Qumber Rizvi
                        Nov 8 at 19:13














                      -1












                      -1








                      -1






                      Navigate to the folder where the file is using cd.



                      Run the following command:



                      chmod a+x FILENAME.sh



                      Hope that helps.






                      share|improve this answer












                      Navigate to the folder where the file is using cd.



                      Run the following command:



                      chmod a+x FILENAME.sh



                      Hope that helps.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Nov 8 at 19:06









                      Qumber Rizvi

                      13




                      13








                      • 1




                        This seems to be a duplicate answer.
                        – Kulfy
                        Nov 8 at 19:10










                      • The answer above mine was taking a different approach earlier. Sorry for the mix up. 😅
                        – Qumber Rizvi
                        Nov 8 at 19:13














                      • 1




                        This seems to be a duplicate answer.
                        – Kulfy
                        Nov 8 at 19:10










                      • The answer above mine was taking a different approach earlier. Sorry for the mix up. 😅
                        – Qumber Rizvi
                        Nov 8 at 19:13








                      1




                      1




                      This seems to be a duplicate answer.
                      – Kulfy
                      Nov 8 at 19:10




                      This seems to be a duplicate answer.
                      – Kulfy
                      Nov 8 at 19:10












                      The answer above mine was taking a different approach earlier. Sorry for the mix up. 😅
                      – Qumber Rizvi
                      Nov 8 at 19:13




                      The answer above mine was taking a different approach earlier. Sorry for the mix up. 😅
                      – Qumber Rizvi
                      Nov 8 at 19:13



                      Popular posts from this blog

                      數位音樂下載

                      When can things happen in Etherscan, such as the picture below?

                      格利澤436b