Go Back   The UNIX and Linux Forums > Operating Systems > Linux > Red Hat
Search Forums:



Red Hat Red Hat is the world's leading open source technology solutions provider with offerings including Red Hat Enterprise Linux (RHEL), Fedora, open source applications, security and systems management, virtualization, and Services Oriented Architecture (SOA) solutions.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-14-2010
Registered User
 

Join Date: Mar 2010
Location: India
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
identifying SU mode by shell script

the following bash script is not working in fedora-11 Could anyone help me please?


Code:
#!/bin/bash

if
[$[`id -u`] -ne  0];then
       echo " you are in root"
else   echo " you must be in root -su mode??"
fi
exit


Last edited by Franklin52; 03-14-2010 at 07:50 AM.. Reason: Please use code tags!
Sponsored Links
    #2  
Old 03-14-2010
Moderator
 

Join Date: Feb 2007
Location: The Netherlands
Posts: 7,287
Thanks: 55
Thanked 427 Times in 408 Posts
Quote:
Originally Posted by Turtel View Post
the following bash script is not working in fedora-11 Could anyone help me please?


Code:
#!/bin/bash

if
[$[`id -u`] -ne  0];then
       echo " you are in root"
else   echo " you must be in root -su mode??"
fi
exit

Replace:

Code:
if [$[`id -u`] -ne  0]

with:

Code:
if [ $(id -u) -ne 0 ]

Be aware of the spaces around the square brackets.
Sponsored Links
    #3  
Old 03-15-2010
Registered User
 

Join Date: Mar 2010
Location: India
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks Franklin very much..........
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Vi Mode of Shell Not Starting almond UNIX for Advanced & Expert Users 4 06-22-2009 04:58 AM
Convet Linux OS from text mode to graphic mode s_linux SuSE 6 02-07-2009 10:18 PM
Identifying prior date in shell script royalibrahim Shell Programming and Scripting 5 12-04-2008 08:38 AM
Script to ftp in non-ineractive mode mshv123 Shell Programming and Scripting 6 09-18-2007 05:45 PM
How to run shell script in silent mode x057373 UNIX for Dummies Questions & Answers 3 12-04-2005 07:26 PM



All times are GMT -4. The time now is 12:24 AM.