How to run a Linux Shell Script?

Have you ever wondered how you can run a script in Linux?
Every script that needs to run should have a execute permission. By default it is refrained from such permission. One has to assign execute bit manually. In order to do so execute following command:

#chmod +x SomeScriptFile
#chmod 0755 SomeScriptFile

ls command can be used to check permissions on files:
# ls -l /bin/uname

-rwxr-xr-x. 1 root root 25948 Feb 8 2011 /bin/uname

[uname is being used for an example, it can be replaced with any script]

To run script:
$ ./SomeScriptFile [Enter]

You can also execute by specifying its full path
$ /full/path/here/

For executing it in ksh shell:
$ ksh SomeScriptFile

For executing in bash shell :
$ bash SomeScriptFile


Creating a test shell script, any text editor can be used.
echo “ Hello, Free World”
echo “ You are at : $(pwd)”

After saving this file, set the execute bit:
$ chmod +x
$ ./

./ can be omitted if current directory has its entry in PATH variable. It is advised to have your own bin directory. Add this directory to PATH variable using export command. Move your recently created script in this directory and save all the hassle of writing whole path, now you can execute this command from anywhere. This procedure is shown below:

$ mkdir $HOME/bin
$ export PATH=$PATH:$HOME/bin
$ mv $HOME/bin