Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Search Forums:



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-05-2009
Registered User
 

Join Date: Jun 2007
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
then: then/endif not found

Hi All
I am getting this error when i try to run script from root using other user profile. Command I am running is

"su - user -c command"


Error envounterd

"then: then/endif not found"

Can any body please help me on this ...
Sponsored Links
    #2  
Old 06-05-2009
Registered User
 

Join Date: Jul 2008
Location: India
Posts: 757
Thanks: 6
Thanked 164 Times in 158 Posts
Try this...

su - user
<enter passwd>
then fire the commands....

-- Jayan Jayaseelan
Sponsored Links
    #3  
Old 06-05-2009
Registered User
 

Join Date: Jun 2007
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
yes it is working like that...but i want to run it in single sommand as i want to crontab it.
It is working on one of my xun machine but not working in the other...
    #4  
Old 06-05-2009
methyl methyl is offline Forum Staff  
Moderator
 

Join Date: Mar 2008
Posts: 5,652
Thanks: 205
Thanked 560 Times in 539 Posts
The syntax from root cron would usually be:


Code:
su user -c "command"

Obviously this does not execute the user's profile - which is often an advantage.


Can you post the contents of the script and state which shell you are using? "endif" is from csh.

Last edited by methyl; 06-05-2009 at 12:20 PM.. Reason: Correction about "endif".
Sponsored Links
    #5  
Old 06-05-2009
Registered User
 

Join Date: Jun 2007
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
the script is not running in c shell for bash shell its ok.
how can we check for c shell dependencies
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
EOF not found uxuser Programming 3 11-17-2008 10:21 AM
-sh: H: not found deal732 Solaris 1 05-29-2007 04:24 PM
Surrounding a chunk of code by #ifdef and #endif xxxaxa Shell Programming and Scripting 6 05-09-2007 01:23 PM
how can i check in csh if command found or not found ? umen Shell Programming and Scripting 2 03-03-2007 06:38 PM
sag.sh[11]: SAG: not found sommer_queen Shell Programming and Scripting 1 09-13-2006 09:20 AM



All times are GMT -4. The time now is 02:57 AM.