![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| finger | felixwhoals | UNIX for Dummies Questions & Answers | 2 | 12-18-2007 09:35 AM |
| Extracting specific info from finger command | franny | UNIX for Dummies Questions & Answers | 1 | 12-05-2007 10:13 AM |
| help in finger command. | shanshine | Shell Programming and Scripting | 1 | 06-06-2007 08:10 AM |
| How to input username on text file into finger command on shell script | Micz | Shell Programming and Scripting | 3 | 11-07-2005 11:38 PM |
| Using the Finger command in a Script | apolishuk | Shell Programming and Scripting | 4 | 12-02-2003 11:42 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
finger command
Hello all,
Here is what I am trying to do. If a user exist, then send an echo "EXIST" or else "DOES NOT EXIST". (under HP-UX) Kind of: Code:
#!/usr/bin/sh
USER=mylogin
finger $USER
if $? = 0
then
echo "EXIST""
else
echo "DOES NOT EXIST"
fi
Does not work at all. Any idea? |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
I have no access to HP-UX and finger is not present in my system.
But I would try "who" piped to "grep" for this purpose. |
|
#3
|
|||
|
|||
|
Quote:
Code:
if [ $? -eq 0 ]; |
|
#4
|
||||
|
||||
|
Checked on HP-UX system
...................................... #!/usr/bin/sh USER=mylogin finger $USER > /dev/null ### Will not display the output of finger command if [ $? -eq 0 ] then echo "EXIST"" else echo "DOES NOT EXIST" fi ........................................ |
|
#5
|
||||
|
||||
|
Finger is disabled on all our servers, just like talk, and rwall are.
You would be better of getting the info from the passwd file. |
|
#6
|
|||
|
|||
|
finger wont help as when I gave bogus username it still gave and o/p for $? as 0
Cheers, |
|
#7
|
|||
|
|||
|
Try:
cat /etc/passwd | grep username 1>/dev/null 2>&1 if [ $? != 0 ] then echo user does not exist else echo user does exist fi |
|||
| Google The UNIX and Linux Forums |