The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
Advantage of executing program in user shell? seeker333 UNIX for Advanced & Expert Users 2 05-21-2008 02:19 PM
Shell Program that prompts for user Id mmg2711 UNIX for Dummies Questions & Answers 1 10-24-2007 07:15 AM
Shell script answer prompts? eltinator Shell Programming and Scripting 4 08-29-2007 11:15 AM
pkgadd pkgask still prompts for user input prkfriryce SUN Solaris 1 06-28-2007 12:27 PM
program running for one user and not for other user bryan UNIX for Advanced & Expert Users 2 11-13-2006 11:09 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-23-2007
mmg2711 mmg2711 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 12
Smile Shell Program that prompts for user Id

Hi

I have a question that after trying tirelessly I cant solve. I'm not great wth UNIX and wonder if anyone could help. I have to create a shell program using functions that prompts for a user ID. I must then verify that the user Id corresponds to an account on the system. If a legal user Id is provided then the pathname of the user's home directory must be displayed. If a user ID that is not recognised is entered an error message must be displayed. Any possible solution would gbe greatly appreciated.

Thanks in advance!
  #2 (permalink)  
Old 10-23-2007
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
This sounds like homework to me. Why must you use functions for example?
  #3 (permalink)  
Old 10-23-2007
mmg2711 mmg2711 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 12
It is not homework but a sample I was given. I dont necessarily have to do it but I would like to see how it is done so I can look at it and try and understand how it works. If anyone has any kind of help at all it would be greatly appreciated. As for the use of functions I'm not sure why they are used. Anyone with help please let me know. Thanks..

Last edited by mmg2711; 10-23-2007 at 11:35 AM..
  #4 (permalink)  
Old 10-23-2007
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
  
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,628
To get user input use the built-in ksh command read. See a ksh manual about how read works.

After having got the input search through /etc/passwd, there are all the users of this system along with their UIDs. Have a look at this file (it is readable for everybody) and you will surely find out how it is organized. Use the command grep (man grep) to search this file with the given input.

bakunin
  #5 (permalink)  
Old 10-24-2007
mmg2711 mmg2711 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 12
Hey does anyone have any sample code on how best to do this. im sure there is an if else statement in it.
  #6 (permalink)  
Old 10-24-2007
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
  
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,628
Quote:
Originally Posted by mmg2711 View Post
im sure there is an if else statement in it.
You have just forfeited the last ounce of good will here. If you do not want to do your work yourself, why should we do your work besides our own? The statement i quoted shows, that you are just making wild guesses instead of looking into manpages, educating and informing yourself or otherwise are unwilling to put any effort in finding a solution apart from writing one-liners here supposed to make us providing you with a script you could then pass on as your own.

The bottom line is: this is despicable.

bakunin
  #7 (permalink)  
Old 10-24-2007
mmg2711 mmg2711 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 12
Despicable?? I thought these forums were meant to help. All I want is a possoble solution. I'm not here to offend anyone.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:42 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0