Re: How to detect user's existence over UNIX



On Oct 19, 7:01 am, Logan Shaw <lshaw-use...@xxxxxxxxxxxxx> wrote:
Rainer Weikusat wrote:
Neo <vikram.su...@xxxxxxxxx> writes:
Is there any generic way to detect user's existence over RHEL and
Solaris? I want to write a shell script to do so. Thanks.

Leaving issue of non-atomicness aside, you could use the id command
for that. 'id <username>' while return a non-zero exit status the user
does not exist.

Alternate method #1:
groups <username>

Alternate method #2:
getent passwd <username>

- Logan

Thanks for all for help !

.



Relevant Pages

  • Re: How to detect users existence over UNIX
    ... Solaris? ... I want to write a shell script to do so. ... 'id ' while return a non-zero exit status the user ... getent passwd <username> ...
    (comp.unix.programmer)
  • Re: need shell script to create users and WWW directories
    ... On Wed, 02 Jul 2003 at 17:18 GMT, Tony wrote: ... > I need a shell script to read a list of users from a file and create them ... while read username ... and may be copied under the terms of the GNU General Public License ...
    (comp.unix.shell)
  • Re: shell script to FTP a file?
    ... I am running Fedora Core 5 Linux and I am looking for a shell script to ... upload a file to a remote FTP server. ... I know the host, username, ...
    (comp.unix.shell)
  • Re: shell script to FTP a file?
    ... I am running Fedora Core 5 Linux and I am looking for a shell script to ... of commands or guidance to write a shell script to FTP the file? ... Put the username and password in your .netrc file (man ftp or man ...
    (comp.unix.shell)