![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Change Account to not lock account if password expires | stringzz | UNIX for Dummies Questions & Answers | 1 | 04-04-2008 06:31 PM |
| sudo, or not sudo: that is the question | iBot | UNIX and Linux RSS News | 1 | 02-07-2008 01:40 PM |
| Setting an account to be a non-login account automatically? | LordJezo | UNIX for Dummies Questions & Answers | 0 | 06-16-2006 10:28 AM |
| Account creation Sudo enabled | vilves | UNIX for Dummies Questions & Answers | 1 | 06-06-2006 11:35 AM |
| ftp in Shellscript | ggowrish | UNIX for Advanced & Expert Users | 3 | 06-11-2004 09:09 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Shellscript to Sudo other account
Hi,
I have to write a shell script to sudo other account. Foreg, i am working in account ramdev1, i have a sudo access where through shell script i need to sudo another account ramdev2 and read a file "ram.inc" get those data and save it in a .txt file and return it? Since i am new to shell script. please do provide a soln. to this. This is really urgent. Expecting positive response. Thanx, Sachin |
|
||||
|
cameron,
I have used "su" to sudo an account ramdev2, now i need to read a file "ram.inc" in a folder /ramenv ,parse it and get only the port no. in it and store it in a .txt file and return it. Since i am pretty much new in reading the file and storing it in a .txt pls. do provide me with an example. Expecting postive response.. Thanx, Sachin |
|
|||||
|
If you used 'su' then you did not sudo. Anyway... for parsing a file, suggest you read through 12 ways to parse a file. That should be a good start. Then regarding storing a variable in a file, go through the man page of any shell (sh/bash/ksh) and search for redirection. That will help too.
|
|
||||
|
Quote:
su is used to switch user account. For ex: By default you logged in into default user, but whn you want to switch the user (say your account ) then you can use "su" command, su - xyz password: ******* |
|
||||
|
blowtorch,
Thank u for the response..I am a Java/J2EE guy. Where i have been a given a shell script to write. Since i am new to this and since you are the moderator can you help me with an example shellscript to sudo other account and read a file "ram.inc" and get only the port no. in it and store it in ram.txt file and return it. Since this is urgent to be delivered can provide me with an example atleast. So that i can modify it according to my need. Thanks, Sachin |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|