Find the answer to your Linux question:
Results 1 to 3 of 3
Hi unix wizards I have a little bit problem here about iterating the arguments that I have passed throught the command line I know that I can reach the arguments ...
  1. #1
    Just Joined!
    Join Date
    Feb 2010
    Posts
    2

    Iterating through arguments

    Hi unix wizards

    I have a little bit problem here about iterating the arguments that I have passed throught the command line

    I know that I can reach the arguments by referencing them as "$1 , $2, or so on.." however is it possible to reference those values as well??

    To clarify what I mean
    for i in `seq 1 ${#}`
    do
    if[ $(($i)) =="blabla" ] // to check if its an expected argument
    then
    fi
    done

    I know that I am missing something very simple but I get stuck

  2. #2
    Linux User
    Join Date
    Nov 2009
    Location
    France
    Posts
    292

    Talking

    Code:
    if [ "${!i}" = "Benny Hill" ]
    0 + 1 = 1 != 2 <> 3 != 4 ...
    Until the camel can pass though the eye of the needle.

  3. #3
    Just Joined!
    Join Date
    Feb 2010
    Posts
    2
    That's what they call a dummy head.
    Thanks dude.! That solved the problem.
    To keep in mind, I have used shifting method can be used as well.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...