To start the UNIX scripting users have to familiar with one of UNIX editors. As a example vi, emacs or PICO.
Open the ‘vi’ editor just type vi and then press ‘i’ to go to the insert mode.
Then type following simple script.
Echo “Hello ”
whoami
Echo “Date and time is :”
Date
echo command dispays the output to the screen.
After that press esc button and type :w followed by the file name
:w example1.sh
Press shift and double z to exit from the vi editor.
After that permission must be given to this file to execute.
This can do using
chmod +x example1.sh
or chmod 755 example1.sh
After executing this command
owner has permission to write, read, and execute,
owner's group have permission to read and execute,
rest of the other people have permission to read and execute.
./example1.sh is used to run the script before set the class path to the current working directory.
To set the path into current working directory
PATH=. : $PATH
After that exmple1.sh can run by typing just example1.sh
Wednesday, August 6, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment