Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Posts
    58

    Unanswered: shell script question

    Can somebody please tell how to capture the last but one function parameter? I tried something like this in vain,

    set -A counts $*
    x=${#counts[*]}
    y=`expr $x -1`
    filename="$(y)" # I tried some of these ...

    Can we do it like that?

    Thanks again!

  2. #2
    Join Date
    Jan 2004
    Location
    Bordeaux, France
    Posts
    320
    Tout simplement :

    eval filename=\$$(($# -1))
    Jean-Pierre.

  3. #3
    Join Date
    May 2003
    Posts
    58
    Thanks a lot for the replies aigles! Also, can you tell how to pass & return an array from a function?

Posting Permissions

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