Quote:
Originally Posted by
sankar_1209
a shell script that takes a login name as command -line argument and reports when that person logs in
i got it with the awk as shown in below but i need it with shell .
$w>file1
$awk -F" " '/loginname/{print $4}' file1
please send me the shell script program
Here's a simple shell script that will generate the same output that
your awk command would produce:
#!/bin/bash
echo "Login time for $1:"
w | grep $1 | awk '{print $4}'
Save that text to a file, eg who.sh, then set executable eg
$ chmod +x who.sh
Then run the script and give it the login name you're looking for eg:
$ ./who.sh myuser