On Sun May 31 2009, Kyle Hamilton wrote: > They could also use $EUID == $UID == 0 to check the user ID, rather > than relying on an external utility. > > ($EUID is the effective user ID, $UID is the real uid. Please see the > bash man page for more info.) >
I didn't want to re-design it. Just point out the difference between an assignment and an equality test. Mike > -Kyle H > > On Sun, May 31, 2009 at 6:05 AM, Michael S. Zick <open...@morethan.org> wrote: > > On Sun May 31 2009, John Kane wrote: > >> After painstakingly commenting everything out of all startup files, then > >> added them back in, I found the cause of the > >> > >> "-bash: [: =: unary operator expected" > >> > >> error that has been occurring on all Linux servers since turning on LDAP > >> TLS on INT. > >> > >> In the file: > >> > >> /etc/profile.d/krb5-workstation.sh > >> > >> The follow is causing the issue: > >> > >> if ! echo ${PATH} | /bin/grep -q /usr/kerberos/sbin ; then > >> if [ `/usr/bin/id -u` = 0 ] ; then > >> PATH=/usr/kerberos/sbin:${PATH} > >> fi > >> fi > >> > >> > >> If I add " " around the backticked command, I the bash error goes away. > >> Not sure who I need to open a ticket against :-) > >> > > > > A more general solution would be: > > > > # Am I running as user 0 (root)? > > uid=$(/usr/bin/id -u) 2>/dev/null > > if [ $uid == 0 ] ; then > > > > Note the use of white space and the change from > > an assignment to a test for equality. > > > > Usually, such problems get reported to the > > distribution producer - they know who wrote > > the script. > > > > Mike > >> Thanks, > >> John > >> > > ______________________________________________________________________ > > OpenSSL Project http://www.openssl.org > > User Support Mailing List openssl-us...@openssl.org > > Automated List Manager majord...@openssl.org > > > ______________________________________________________________________ > OpenSSL Project http://www.openssl.org > User Support Mailing List openssl-users@openssl.org > Automated List Manager majord...@openssl.org > > ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org