Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: making shell ignore braces



On May 4, 12:42pm, Frank Terbeck wrote:
} Subject: Re: making shell ignore braces
}
} Eric Smith <es@xxxxxxxxxxxx>:
} > How do I get the shell not to interpret `()' chars, so
} > $ dial 00 49 (713) 999 999
} > must pass only the numbers to the dial script.
} > and not complain
} > zsh: no matches found: (713)
} 
} % noglob dial 00 49 (713) 999 999

That's only part of the answer -- as I read it, Eric also wants the
parens to be discarded so that "dial" sees only digits.

The only reasonable way to accomplish that is to create a wrapper
script or function around "dial".  If "dial" is itself a script, it
might be more appropriate to change that script so that it discards
the parens itself, in which case Frank's answer would finish the job.

A wrapper function might look like

  # Use the "function" keyword to avoid conflicts with aliases
  function dial {
    # Strip non-numerics that commonly appear in phone numbers
    command dial "${@//[-+.()]/}"
  }
  alias dial='noglob dial'



Messages sorted by: Reverse Date, Date, Thread, Author