There are several ways to run scripts:-
./my_commandsThis executes the my_commands file as a child process with the shell as specified on the first line (if the #! trick is used) or the default shell if not.
sh -x my_commandsThis executes the my_commands file as a child process with the Bourne shell. The -x is optional and results in each line being typed out as it is executed which helps when debugging.
To do the same thing in the C shell:-
csh -x my_commands
. my_commands(yes the command really is just a dot!) and for the c shell:-
source my_commands
The most common reason to source a script like this rather than run it as a separate child process is because it contains commands that change your environmental variables (see section 6.2.5). If you were to execute these in a child process they would only change its environment and would be lost when the child process terminated.
You can only source script files that are suitable for the parent shell.So if you use the C or T shell as your interactive shell then you will have to write any script you want to source using the C shell.