The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > SUN Solaris
.
google unix.com



SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How do i change to super user then revert back to ordinary user ,using shell script? wrapster Shell Programming and Scripting 3 06-04-2008 07:11 AM
Script using awk works only as super user gjithin Shell Programming and Scripting 10 05-09-2008 09:30 AM
Shell Script: want to insert values in database when update script runs ring Shell Programming and Scripting 1 10-25-2007 03:06 AM
What user runs cron? michieka UNIX for Dummies Questions & Answers 10 06-02-2002 10:32 PM
FTP as Super User fbavent UNIX for Dummies Questions & Answers 3 05-22-2002 11:49 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-09-2008
gjithin gjithin is offline
Registered User
  
 

Join Date: May 2008
Posts: 16
Sunsolaris shell script runs only as super user

Hi Friends,
I am new to Sun solaris unix.I am facing problem while runing my kornshell script just as an ordinary user.The script works fine while i am working as a super user.the script just uses awk to check the first charcter of a file and then copies the file to another folder. Do i need to change any enviornment variable. Please help

Jithin.G
  #2 (permalink)  
Old 05-09-2008
fabtagon fabtagon is offline
Registered User
  
 

Join Date: Apr 2008
Location: European Union/Germany
Posts: 189
What error messages do you get?
Post your script.
Are you sure you (as normal user) have the rights to read this file ans write to the other folder? What do "ls -l your_file" and "ls -ld your_folder" say?
  #3 (permalink)  
Old 05-09-2008
gjithin gjithin is offline
Registered User
  
 

Join Date: May 2008
Posts: 16
my script is

line=$(awk '{if(substr($0,1,1)!="#" &&
substr($0,1,1)!=";" &&
substr($0,1,1)!=" " &&
substr($0,1,1)!="/" &&
substr($0,1,1)!="*" &&
substr($0,1,1)!="\\" &&
length($0)!=0)
{print $0}
}' filename

This works fine when i login as super user but it does not work with other user and show error.

I am still geting the error

....ksh[line]: awk: not found

ls -l file name gives
-rwxrwxrwx 1 jithin other 38388 date filename

ls -ld folder gives
drwxrwxrwx 2 jithin other 512 date foldername
  #4 (permalink)  
Old 05-09-2008
fabtagon fabtagon is offline
Registered User
  
 

Join Date: Apr 2008
Location: European Union/Germany
Posts: 189
pretty obvious:
Code:
ksh[line]: awk: not found
Your $PATH environment variable as normal user does not consist of the directory where your awk resides. What give "which awk" and "echo $PATH" as superuser? What gives "echo $PATH" as normal user? Add the missing dir to normal user's $PATH.
  #5 (permalink)  
Old 05-09-2008
gjithin gjithin is offline
Registered User
  
 

Join Date: May 2008
Posts: 16
$PATH in super user has another component /usr/sbin
But which awk in both super user and user gives /usr/bin
I tried to change $PATH in *.profile file of user .it changes in file . But then again i checked the echo $PATH it shows the same earlier result.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:08 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0