Dynamic number of parameter

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

Something like this???

ps -ef | grep 'pattern_to_search' | awk '{ print $1 }' | xargs kill -9

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

You dont have to do anything big.

go through the following which will help you.,

$ 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
$ 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

thanks :slight_smile: a lot guys