chmod +x script.sh
./script.sh
You can also run the script directly without setting the script execute permission
bash script.sh
orsource script.sh
or
. script.sh
In the last example we are using . (dot) or source command which reads and executes commands from filename in the current shell.
When a script is executed using either the bash command or the source (.) command, you don't have to set execute permission on script.
reference: http://www.cyberciti.biz
No comments:
Post a Comment