How to Pass More then 10 argument in ShellScript

Viewed 1550
 sed  -e "s/${MyToken}/${arg}/g" file

Value Of 'arg' working fine till 9th argument.after 10th arguments its failing

1 Answers

Here is an example :

#!/bin/ksh   
echo There is $# parameters
while [ $# -ne 0 ]; do
         echo $1
         shift
    done

The output :

     Will:/home> ./script a b c d e f g h i j k l m n o p q r s t u v w x y z
     There is 26 parameters
        a
        b
        c
        d
        e
        f
        g
        h
        i
        j
        k
        l
        m
        n
        o
        p
        q
        r
        s
        t
        u
        v
        w
        x
        y
        z

$#count the number of parameters passed to your script.

Shift is moving the param to the left so after one loop $1 become b and so on.

Related