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

Re: why doesn't 'source *' work?



Replying to message of 10 Apr 1999 23:19:06 +0100
	from Bruce Stephens <bruce@xxxxxxxxxxxxxxxxxxxx>
	regarding ``Re: why doesn't 'source *' work?''
	
> > Is there a reason why 'source *' doesn't work?

> In what way doesn't it work?

$ cd /Users/tjl/Unix/zsh/source/functions/complex
$ ls
addwhite            df-sort-by-used     oeu
cd                  ej                  pine
cksub               extract-serv        replace-icon
del                 kill                replace-serv
df-sort             lkincds             unimg
df-sort-by-avail    ls-tar              untar
df-sort-by-mount    mv2lbin             verify
df-sort-by-percent  mv2scripts          whois
df-sort-by-size     oaf                 wn-to-rtf
$ which oeu
oeu not found
zsh: exit 1
$ source *
$ which oeu
oeu not found
zsh: exit 1
$ PATH=$PATH:.
$ source *
$ which oeu
oeu not found
zsh: exit 1
$ echo $PATH_DIRS

$

> According to the manual:

> If any arguments arg are given, they become the positional
> parameters; the old positional parameters are restored when the
> file is done executing.  The exit status is the exit status of the
> last command executed.
>
> I'm guessing you missed the bit about the positional parameters.

Or just don't understand what the heck that means.



> If you want to source all the files (giving them no parameters),
> you'll need to use a loop:
>
> for i in *
> do
> source $i
> done

even simpler (and seems to work):

for i in ~/Unix/zsh/source/functions/complex/*; source $i

however I still don't understand why 'source *' doesn't accomplish the same  
thing... perhaps I'm a bit dense.


> You could wrap this in an autoloaded function, if you wanted.  But not
> a shell script, obviously.  (Well, probably not.)

I added

for i in ~/Unix/zsh/source/functions/complex/*; source $i

to my .zshenv... that seems to work.


TjL





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