The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > 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 04:11 AM
Script using awk works only as super user gjithin Shell Programming and Scripting 10 05-09-2008 06:30 AM
Shell Script: want to insert values in database when update script runs ring Shell Programming and Scripting 1 10-25-2007 12:06 AM
What user runs cron? michieka UNIX for Dummies Questions & Answers 10 06-02-2002 07:32 PM
FTP as Super User fbavent UNIX for Dummies Questions & Answers 3 05-22-2002 08:49 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-09-2008
Registered User
 

Join Date: May 2008
Posts: 16
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
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
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-09-2008
Registered User
 

Join Date: Apr 2008
Location: European Union/Germany
Posts: 180
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
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?
Reply With Quote
  #3 (permalink)  
Old 05-09-2008
Registered User
 

Join Date: May 2008
Posts: 16
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
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
Reply With Quote
  #4 (permalink)  
Old 05-09-2008
Registered User
 

Join Date: Apr 2008
Location: European Union/Germany
Posts: 180
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
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.
Reply With Quote
  #5 (permalink)  
Old 05-09-2008
Registered User
 

Join Date: May 2008
Posts: 16
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
$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.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:31 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101