[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Sourcing a script renders getopts impotent (or is it just me?)
From: |
Greg Wooledge |
Subject: |
Re: Sourcing a script renders getopts impotent (or is it just me?) |
Date: |
Fri, 17 Sep 2010 08:37:32 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Thu, Sep 16, 2010 at 02:06:11PM -0700, Mun wrote:
> I have a script which uses getopts that I need to source in my
> interactive shell. The problem is that if I source it, getops behaves
> as if no arguments were passed into the script.
What are you actually doing? It works for me:
imadev:~$ cat ~/bin/args
#! /bin/sh
printf "%d args:" $#
printf " <%s>" "$@"
echo
imadev:~$ set -- one two three
imadev:~$ source args
3 args: <one> <two> <three>