Visit The New, Modern Unix Linux Community

Script using awk works only as super user

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script using awk works only as super user
# 1  
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)!="\\" &&
{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

# 2  
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
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  
Thak you i will try and look into it
# 4  
still the same

I am still geting the error

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

but with superuser it stll working
# 5  
Login as superuser:- 
type awk

then login as other user and add awk path to PATH variable in .profile and relogin

# 6  
$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
# 7  
after changing $PATH in .profile you need to relogin

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #736
Difficulty: Medium
In 1982, Commodore introduced the Commodore 64 as the successor to the VIC-20.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Will Chkconfig works for normal user apart from root user

Hi, I am trying to schedule a script that starts on reboot.I came across chkconfig utility to schedule scripts on reboot. Problem here is can i how to use this chkconfig to schedule a script that runs a s normal user. Or if there is any other function to schedule on reboot as normal user... (4 Replies)
Discussion started by: praveena kotapa
4 Replies

2. UNIX for Advanced & Expert Users

How can I run command with super user privledge

Hello All, I am working on UNIX like environment. This environment is ported from UNIX. Here when we need to build product set, we need to run some script with super user privledge (which we normal user dont have) Is there any way (some C program or some script) through which any normal... (2 Replies)
Discussion started by: joshi123
2 Replies

3. UNIX for Advanced & Expert Users

loggin remote computer as a super user.

hello all, can i loggin remote computer as a super user(i know root user/passwd) and change his access controlle list. if yes please tell me how to do it, i am new to linux. thank you. (6 Replies)
Discussion started by: zius_oram
6 Replies

4. Shell Programming and Scripting

auto login to Super User account

i want to write to script which will login to su account without hving user interaction.( i know Super user password) i wrote following script its also able to log into su account. but seesion gets terminates soon. what can be done ??? or is there any other solution. i don't want to use expect... (6 Replies)
Discussion started by: anup13
6 Replies

5. Shell Programming and Scripting

How do i change to super user then revert back to ordinary user ,using shell script?

Hi all, I am trying to eject the cdrom from a livecd after certain stage... Now assuming that it is possible to eject,please consider my issue!!! The OS boots into a regular user by i am unable to use the eject command to push out the drive... However if i try pfexec eject it... (3 Replies)
Discussion started by: wrapster
3 Replies

6. Solaris

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... (4 Replies)
Discussion started by: gjithin
4 Replies

7. UNIX for Dummies Questions & Answers

rsh as super user without password prompt

Dear forum, First off, I'm using Solaris 5.6 UNIX. I'm trying to write a script which will connect to remote computers on a network (by specific IP's from a hosts file) and will run a separate script which is installed in each of the remote computers. My problem is that to run the script in the... (1 Reply)
Discussion started by: TheMightyUrrrrf
1 Replies

8. HP-UX

BAD SUPER BLOCK - Run fsck with alternate super block number

Error received when I tried to restore a blank disk with an 'auto recovery' DDS tape via HP-UX recovery system 2.0 onto a 1Gb SCSI. I assumed it would do the setup, wrong. Could someone tell me the procedure to initial disk for recovering files using cpio. The system is a HP-UX 9.04 version on a... (1 Reply)
Discussion started by: admin wanabee
1 Replies

9. UNIX for Advanced & Expert Users

reassigning key functions in super user mode

At my old job the TAB key was used in Super User mode rather than the default of the ESC key. I was wondering how to reassign the TAB key so that it acquires the functions of the ESC key. Thanks for the help. -Shana (5 Replies)
Discussion started by: lehcar511
5 Replies

10. UNIX for Dummies Questions & Answers

FTP as Super User

How do you FTP as a Super User? I need to send some files into a cgi-bin directory. I can telnet in as a SU but, cannot figure out how to do it with FTP. Thanks, Frank (3 Replies)
Discussion started by: fbavent
3 Replies

Featured Tech Videos