37 lines
734 B
Text
37 lines
734 B
Text
|
Shell Test
|
||
|
$ 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
|
||
|
$ vi demo
|
||
|
#!/bin/sh
|
||
|
#
|
||
|
# Script that demos, command line args
|
||
|
#
|
||
|
echo "Total number of command line argument are $#"
|
||
|
echo "$0 is script name"
|
||
|
echo "$1 is first argument"
|
||
|
echo "$2 is second argument"
|
||
|
echo "All of them are:- $* or $@"
|
||
|
# vi /etc/bashrc
|
||
|
# At the end of file add following in /etc/bashrc file
|
||
|
#
|
||
|
# today() to print formatted date
|
||
|
#
|
||
|
# To run this function type today at the $ prompt
|
||
|
# Added by Vivek to show function in Linux
|
||
|
#
|
||
|
today()
|
||
|
{
|
||
|
echo This is a `date +"%A %d in %B of %Y (%r)"`
|
||
|
return
|
||
|
}
|