![]() |
|
|
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 |
| [Oracle] "Dynamic" sql / Shell script | alan | Shell Programming and Scripting | 4 | 03-13-2009 11:07 AM |
| Q: Recording shell script screen output using "script" command ? | lalfonso.gomez | Shell Programming and Scripting | 4 | 01-18-2007 09:31 PM |
| How to get Find command work with a variable passing "*" value? | unxuser | Shell Programming and Scripting | 5 | 08-16-2006 11:47 AM |
| Passing argument to "at" command | nibl | Shell Programming and Scripting | 2 | 07-23-2006 12:36 AM |
| No utpmx entry: you must exec "login" from lowest level "shell" | peterpan | UNIX for Dummies Questions & Answers | 0 | 01-18-2006 04:15 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
passing a list of dynamic names to a "PS" command in shell script?
Hi,
I am new to shell script. This is my first post .I have written a small script which returns list of names starts with "ram" in /etc/passwd .Here is that:- #!/bin/ksh NAME_LIST="name_list.txt" cat /dev/null > $NAME_LIST evalcmd="cat /etc/passwd | grep "^ram?*" | cut -d: -f1" eval $evalcmd > $NAME_LIST 2>&1 echo $? if [[ $? -ne 0 ]] then echo "Failed to create list of names"; else echo "List of names are created successfully"; fi The thing is that i need to pass these dynamic names from /etc/passwd to a "ps" command like:- ps -o user,fname -U ram,ramdev1,ramdev2,ramdev3 Since i cannot hardcode the names like ram,ramdev1,ramdev2,etc i need to pass these names in a single command. something like:- cat /etc/passwd | grep "^ram?*" | cut -d: -f1| ps --o user,fname -U <dynamic variable which fetches the whole name in /etc/passwd> Since i am pretty much new to shellscript.Please do help me on this. This is really urgent to be delivered. Hence pls. do the needful. Thanx, Sachin |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|