I am new to UNIX , Can any one let me know how to execute shell script (i.e which command I have to use for the same).
Any help would be appreciated.
Thanks
siva
mymvs999@yahoo.com
I am new to UNIX , Can any one let me know how to execute shell script (i.e which command I have to use for the same).
Any help would be appreciated.
Thanks
siva
mymvs999@yahoo.com
If the script is in the directory you are in (man pwd)
% ./myscript
Also check the permissions - it should have r-x for the appropriate user ID (man chmod)
ls -l myscript
-rwx-r-x-r-x owner group size myscript
Or you can execute with the full path
% /yourfilestructure/yourscripts/myscript
Realize where it has your or my, it changes to whatever directory and path are correct for your system.
%sh <shell-script>
should also work. Not sure if the same applies for all shells.
As syntaxes differ from one shell to the other it's a good habit to specify the shell to be used in the first line of each script file.
Something like:
#!/usr/bin/ksh
Then you won't need to specify any shell on your command line - ie you'd just enter: ./myScript.sh