(M)  s i s t e m a   o p e r a c i o n a l   m a g n u x   l i n u x ~/ · documentação · suporte · sobre

 

2.1. Invoking the script

Having written the script, you can invoke it by sh scriptname, or alternately bash scriptname. (Not recommended is using sh <scriptname, since this effectively disables reading from stdin within the script.) Much more convenient is to make the script itself directly executable by

Either:

chmod 755 scriptname (gives everyone execute permission)

or

chmod +x scriptname (gives everyone execute permission)

chmod u+x scriptname (gives only the script owner execute permission)

In this case, you could try calling the script by ./scriptname.

As a final step, after testing and debugging, you would likely want to move it to /usr/local/bin (as root, of course), to make the script available to yourself and all other users as a system-wide executable. The script could then be invoked by simply typing scriptname [return] from the command line.