LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 04-22-2004, 07:52 AM   #1
sanjith11
Member
 
Registered: Oct 2003
Distribution: redhat
Posts: 63

Rep: Reputation: 15
changing the user inside a shell script


hi,

when ever i make a script with the contents

*******/script/***********

sys -lu user_name;
ls;

***********************

and run it

the user changes,but the list command dosent work .
ls works only after i quit from the new user_name area.

how can i avoid this if i want to run some command's under the user_name

thanks
 
Old 04-22-2004, 08:29 AM   #2
Looking_Lost
Senior Member
 
Registered: Apr 2003
Location: Eire
Distribution: Slackware 12.0, OpenSuse 10.3
Posts: 1,120

Rep: Reputation: 45
Don't know about sys but how about su

su user_name -c ls

and

man suauth

if you want to avoid having to enter a password
 
Old 04-22-2004, 08:44 AM   #3
sanjith11
Member
 
Registered: Oct 2003
Distribution: redhat
Posts: 63

Original Poster
Rep: Reputation: 15
sys -lu user_name -c command

the above thing works without authenticaton and also executes the command.

But i want to run many commands .Even making all the commands in to a script is not enough here.

thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem executing mv command inside shell script pablogosse Linux - General 7 12-16-2009 01:21 PM
Shell script inside shell script treotan Linux - General 4 02-19-2009 07:34 AM
help changing case on arguments to bourne shell script Maldain Programming 2 05-03-2005 11:18 AM
changing user in a shell script sanjith11 Programming 6 03-22-2004 02:18 PM
Running FTP inside Shell Script truncates files jbhanc0125 Red Hat 3 01-16-2004 12:37 PM


All times are GMT -5. The time now is 09:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration