Results 1 to 3 of 3

Thread: zsh: pass named parameter to script

  1. #1
    Join Date
    Aug 2007
    Location
    Denmark
    Beans
    Hidden!
    Distro
    Xubuntu 12.10 Quantal Quetzal

    zsh: pass named parameter to script

    I want to run my zsh script something like this:

    Code:
    ./myscript.sh -w some-text -m some-other-text
    I then want to get the information in the -w and -m parameter, just like most other unix programs. The syntax of the script execution is not important, but the named reference to parameters is. Is there an easy way to do so in zsh?

    BTW: What is this thing called?
    Last edited by kkjaergaard; April 16th, 2013 at 08:43 PM.

  2. #2
    Join Date
    Apr 2012
    Beans
    7,003

    Re: zsh: pass named parameter to script

    It's usually called 'getopts' or 'getopt' - I don't use zsh myself but it appears to have a builtin version - see

    Code:
    man zshbuiltins

  3. #3
    Join Date
    Aug 2007
    Location
    Denmark
    Beans
    Hidden!
    Distro
    Xubuntu 12.10 Quantal Quetzal

    Re: zsh: pass named parameter to script

    Thanks, just what I was looking for.

Bookmarks

Posting Permissions

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