The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

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 08:11 AM
Sunsolaris shell script runs only as super user gjithin SUN Solaris 4 05-09-2008 09:47 AM
rsh as super user without password prompt TheMightyUrrrrf UNIX for Dummies Questions & Answers 1 02-13-2008 10:50 AM
reassigning key functions in super user mode lehcar511 UNIX for Advanced & Expert Users 5 06-19-2003 01:03 PM
FTP as Super User fbavent UNIX for Dummies Questions & Answers 3 05-23-2002 12:49 AM

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
Script using awk works only as super user

hi friends,

I am a new Sun Solaris 10 user. I have the following script

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.

Do i need to change any enviornment variables please help

Thanks
Jithin.G
  #2 (permalink)  
Old 05-09-2008
jim mcnamara jim mcnamara is online now Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,773
I'm guessing there is an alias awk=nawk. Solaris awk is, um, defective, so advanced features require nawk - the new awk. As superuser, try
Code:
type awk
, then see what you get as another user from the same command.

In general you do not want to run around the system doing things in privileged mode. It's to easy to do something horrendous
  #3 (permalink)  
Old 05-09-2008
gjithin gjithin is offline
Registered User
  
 

Join Date: May 2008
Posts: 16
Thak you i will try and look into it
  #4 (permalink)  
Old 05-09-2008
gjithin gjithin is offline
Registered User
  
 

Join Date: May 2008
Posts: 16
still the same

I am still geting the error

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

but with superuser it stll working
  #5 (permalink)  
Old 05-09-2008
aju_kup aju_kup is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 189
Code:
Login as superuser:- 
type awk

then login as other user and add awk path to PATH variable in .profile and relogin
  #6 (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.

The env command also shows earlier $PATH
Closed Thread

Bookmarks

Tags
solaris

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 12:23 PM.


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