I'm new to Ubuntu and currently on it because of assignment. I would like to ask few questions:
How do I make new command to run a shell script? For example, when you type
passwdon terminal it runs the executable file on/usr/bin/passwd. How do I make it the same like my file?How do I change my shell script into a executable file like the
passwd?
1 Answer
Your script should look like:
#!/bin/bash passwd Save it in a file, let say password.sh or simple password, then make it executable using next commands in terminal:
cd /path/to/password.sh #or cd /path/to/password chmod +x password.sh #or chmod +x password To run it from terminal, just use the following command:
./password.sh #or ./password or
/path/to/password.sh #or /path/to/password To run it only using:
password.sh #or password you must to add the path of the script to the PATH. See How to add a directory to the PATH? in this sense.
10