![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SYSLOG Source code location | jockey007 | UNIX for Advanced & Expert Users | 3 | 11-06-2007 05:04 PM |
| Location code for pdisk | Muktesh | AIX | 1 | 08-23-2007 07:36 PM |
| home directory | nokia3100 | UNIX for Dummies Questions & Answers | 1 | 05-07-2007 03:16 PM |
| cd into home directory ~ | here2learn | UNIX for Dummies Questions & Answers | 4 | 04-12-2005 10:20 AM |
| c++ home directory?? | user666 | UNIX for Dummies Questions & Answers | 3 | 03-16-2002 09:49 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hello All,
I am a teacher at a local high school, and we have put together a small computer and loaded a linux distro onto it for the students to experiment with, because 20 children share the computer, it is hard to keep track of there home directorys, i was wondering if i could find a script for the location of the users home directory, so i could load a terminal, type in the command followed by the users name, and i could find where the users home directory is, i know i can see it in the /ect/password, but a script would be much easier any help would be greatly appriciated |
|
||||
|
thanks, but is there another way of doing it through the bash shell?
![]() Maybe Using the Grep Command and the Cut Command to Give Me and Entire Line of Information from the etc/Passwd on the user? thanks Last edited by hks_turbokits; 10-28-2007 at 09:01 AM.. |
|
||||
|
Quote:
Code:
grep username /etc/passwd | cut -d ":" -f 6 or awk Code:
grep username /etc/passwd | awk 'BEGIN {FS="[:]"} { print $6 }'
|
|
||||
|
Almost Finished....
Thanks for your help so far guys, im almost done now, there is just one bit i need help with, i would like it to display a reply for a user who doesnt exist, such as, User Not found or similar This is my code so far Code:
echo "Which Users home directory to you want to locate?" read Username grep "^$Username" /etc/passwd | cut -d ":" -f 6 I was reading somewhere about a case or something something about using Code:
if [ $? -eq 0 ] ![]() Thanks Again |
![]() |
| Bookmarks |
| Tags |
| linux |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|