|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | 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. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi all
Is there away to create a script with dynamic number of parameter.. like the kill command in UNIX kill -9 xxx xxx cheers |
| Sponsored Links | |
|
|
|
#2
|
||||
|
||||
|
Something like this??? Code:
ps -ef | grep 'pattern_to_search' | awk '{ print $1 }' | xargs kill -9 |
| Sponsored Links | ||
|
|
|
#3
|
|||
|
|||
|
no i didn't mean that i mean if i want to create new script which will ptree the process and log the output then kill it
for example script.sh -9 xxxx script.sh -9 xxxx yyyy zzzz |
|
#4
|
|||
|
|||
|
You dont have to do anything big. go through the following which will help you., Code:
$ bash a.sh -9 1 3 4 5 All arguments: -9 1 3 4 5 name of script is a.sh first argument is -9 second argument is 1 seventeenth argument is -97 number of arguments is 5 Code:
$ cat a.sh echo "All arguments: $@" echo name of script is $0 echo first argument is $1 echo second argument is $2 echo seventeenth argument is $17 echo number of arguments is $# Refer this: Bash by example, Part 2 |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
thanks
a lot guys |
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sql dynamic table / dynamic inserts | magedfawzy | UNIX for Advanced & Expert Users | 0 | 09-25-2009 03:37 PM |
| checking if parameter passed is a number | magnia | UNIX for Dummies Questions & Answers | 2 | 07-20-2009 06:56 AM |
| how do I make dynamic parameter names? Or get the value of a parameter evaluated twi | Awanka | Shell Programming and Scripting | 2 | 04-19-2007 09:37 PM |
| Parameter in UNIX restricting the number of lines that can be mailed | superprg | UNIX for Dummies Questions & Answers | 2 | 08-23-2006 05:25 AM |
|
|