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

Re: source ~/dir/*.zsh



TJ Luoma wrote:
> My idea was to put them all into a special directory and then source
> them like so in ~/.zshenv
>
>       source ~/dir/*.f.zsh
>
> But that doesn't seem to work.

You'll have to use a for loop, because this is not how `source' works
(see below).

> I'm not getting any errors, it just doesn't seem to actually do anything.

It should source *one* file:

  source file [ arg ... ]
       Same  as  `.', except  that  the  current directory  is
       always searched  and is  always searched  first, before
       directories in $path.

  . file [ arg ... ]
       Read commands from file and execute them in the current
       shell environment.
     [...]
       If  any  arguments  arg  are  given,  they  become  the
       positional  parameters; the  old positional  parameters
       are restored when the file  is done executing.
     [...]


So, if you'd add a line

  printf '%s\n' "$@"

to the top of the alphabetically first file in the directory, it should
print the names of the other files because `source' will put them into
the positional parameters during the execution of the first file.

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925



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