본문 바로가기

OS/Shell script

[쉘스크립트] Linux Shell Scripting


1. Create a script
$ vi  myscript.bash
$ vi  myscript.sh
$ vim  myscript.bash

2. Setup executable permission
$ chmod +x your-script-name
$ chmod 755 your-script-name

3. Run a script (execute a script)
$ bash bar
$ sh bar
$ ./bar

4. example
$ vi ginfo
#
#
# Script to print user information who currently login , current date & time
#
clear
echo "Hello $USER"
echo "Today is \c ";date
echo "Number of user login : \c" ; who | wc -l
echo "Calendar"
cal
exit 0