![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| Command assistance | kmuir | UNIX for Dummies Questions & Answers | 0 | 02-26-2008 11:59 PM |
| how to move word by word on command line | pbsrinivas | UNIX for Dummies Questions & Answers | 1 | 11-23-2007 06:17 AM |
| Assistance with Perl and HTTP | bryanthomas | Shell Programming and Scripting | 7 | 12-11-2006 09:38 PM |
| Can a shell script pull the first word (or nth word) off each line of a text file? | tricky | Shell Programming and Scripting | 5 | 08-17-2006 07:29 AM |
| paste command | mariner | UNIX for Advanced & Expert Users | 5 | 03-04-2005 02:42 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Perl script assistance; paste word into external command
I'm attempting to create a Perl script that will:
Take the contents of the usernames.tmp file (usernames.tmp is created from an awk one-liner ran against /etc/passwd) Take one line at a time and pass it to the su command as a users name. This should go on until there is no more name to process However there is one tiny problem, this is my first exposure to Perl scripting! And I have no idea how to do this. The code below is my full heated attempt at clobbering together code found around the office. Code:
!#/usr/bin/perl
open (USRLIST, "</tmp/usernames.tmp") || die ("die statement");
defined $USERS = (<USRLIST>);
foreach $NAME (@$USERS)
{
exec "su - $NAME;cd;/path/to/script2";
}
be a real treat!! Thanks in advance! -- -Adam B. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|