[98491] in RedHat Linux List

home help back first fref pref prev next nref lref last post

A script problem

daemon@ATHENA.MIT.EDU (Zoki)
Mon Nov 9 10:47:07 1998

Date: Mon, 9 Nov 1998 16:03:19 +0100 (CET)
From: Zoki <zokiphoto@magic.fr>
To: Red Hat Users List <redhat-list@redhat.com>
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com

I can't seem to understand where I'm making the mistake in the next
script. Basically, it has to test for the username and accordingly start
other scripts. I figured out I should be using "id", export it and then do
an if construction to test for the name of the user. The script seems to
scip the "testing part" and goes straight to the else statement. Where
would be the problem? Keep in mind I'm only starting with scripting.


********* The script *********************

#!/bin/sh

if  [ '/usr/bin/id -un' = "zokiphoto" ]; then
	### commands ###
elif [ '/usr/bin/id -un' = "root" ]; then
	### commands ###
else
	### exit message ###
exit 1
fi


Thanks!
Zoki.
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
ZOKImage Paris
	Creation d'images est traitement numerique
			Image creation & digital tweaking
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/

Mailed with Linux and Pine.


-- 
  PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
		http://www.redhat.com http://archive.redhat.com
         To unsubscribe: mail redhat-list-request@redhat.com with 
                       "unsubscribe" as the Subject.


home help back first fref pref prev next nref lref last post