On Wed, 2003-06-18 at 12:39, Frank Sorenson wrote:
> If all you're trying to do is to get a user's shell, you could write up a 
> pretty short program that calls getpwnam, and outputs the shell:
> #include <stdio.h>
> #include <pwd.h>
> #include <sys/types.h>
> 
> int main(int argc, char *argv[])
> {
>    struct passwd *Passwd;
>    Passwd = getpwnam(argv[1]);
>    printf("%s", Passwd->pw_shell);
> }

More simply, you could just grep it out of /etc/passwd--but once again
this does no good. The original poster needs the information while
sourcing shell environmental. The user may or may not be in their
standard shell. I generally use ksh at work, but sometimes (rarely) jump
into bash. (Vi bindings so much better in ksh, and I'm too lazy to write
my own .inputrc to get it to do what I want in bash.) I want my .profile
to work equally well in both.

-- 
Stuart Jansen <[EMAIL PROTECTED], AIM:StuartMJansen>

"What hole did you dig that up from?" 
   -- my roommate commenting on my taste in music

Attachment: signature.asc
Description: This is a digitally signed message part

____________________
BYU Unix Users Group 
http://uug.byu.edu/ 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to