* Re: why doesn't 'source *' work?
@ 1999-04-10 23:49 Timothy J Luoma
1999-04-11 0:22 ` Bruce Stephens
0 siblings, 1 reply; 5+ messages in thread
From: Timothy J Luoma @ 1999-04-10 23:49 UTC (permalink / raw)
To: zsh-users
Replying to message of 10 Apr 1999 23:19:06 +0100
from Bruce Stephens <bruce@cenderis.demon.co.uk>
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: why doesn't 'source *' work?
1999-04-10 23:49 why doesn't 'source *' work? Timothy J Luoma
@ 1999-04-11 0:22 ` Bruce Stephens
1999-04-11 0:30 ` Timothy J Luoma
0 siblings, 1 reply; 5+ messages in thread
From: Bruce Stephens @ 1999-04-11 0:22 UTC (permalink / raw)
To: zsh-users
Timothy J Luoma <tjlists@bigfoot.com> writes:
> > 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 do "source a b c d e", then the file "a" gets sourced, with the
positional parameters set: $1 gets set to "b", $2 to "c", $3 to "d"
and $4 to "e".
The same kind of behaviour that you get with shell functions and
things.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: why doesn't 'source *' work?
1999-04-11 0:22 ` Bruce Stephens
@ 1999-04-11 0:30 ` Timothy J Luoma
0 siblings, 0 replies; 5+ messages in thread
From: Timothy J Luoma @ 1999-04-11 0:30 UTC (permalink / raw)
To: zsh-users
Replying to message of 11 Apr 1999 01:22:59 +0100
from Bruce Stephens <bruce@cenderis.demon.co.uk>
regarding ``Re: why doesn't 'source *' work?''
> If you do "source a b c d e", then the file "a" gets sourced, with the
> positional parameters set: $1 gets set to "b", $2 to "c", $3 to "d"
> and $4 to "e".
>
> The same kind of behaviour that you get with shell functions and
> things.
Ah.... as one of my teacher's used to say:
``Light dawns on marble head.''
Thanks for the explanation, I guess that does make sense.
TjL
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: why doesn't 'source *' work?
1999-04-10 18:39 Timothy J Luoma
@ 1999-04-10 22:19 ` Bruce Stephens
0 siblings, 0 replies; 5+ messages in thread
From: Bruce Stephens @ 1999-04-10 22:19 UTC (permalink / raw)
To: zsh-users
Timothy J Luoma <tjlists@bigfoot.com> writes:
> Is there a reason why 'source *' doesn't work?
>
> Is there a setopt I need to configure?
In what way doesn't it work?
According to the manual:
. file [ arg ... ]
Read commands from file and execute them in the current shell
environment. If file does not contain a slash, or if PATH_DIRS is
set, the shell looks in the components of $path to find the
directory containing file. Files in the current directory are not
read unless `.' appears somewhere in $path.
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.
source is approximately the same as ".".
I'm guessing you missed the bit about the positional parameters.
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
You could wrap this in an autoloaded function, if you wanted. But not
a shell script, obviously. (Well, probably not.)
^ permalink raw reply [flat|nested] 5+ messages in thread
* why doesn't 'source *' work?
@ 1999-04-10 18:39 Timothy J Luoma
1999-04-10 22:19 ` Bruce Stephens
0 siblings, 1 reply; 5+ messages in thread
From: Timothy J Luoma @ 1999-04-10 18:39 UTC (permalink / raw)
To: zsh-users
Is there a reason why 'source *' doesn't work?
Is there a setopt I need to configure?
Thanks
TjL
ps -- I'm using zsh-3.1.4, mainly since I'm no longer sure where to get
current source for zsh and last time I tried it bombed when trying to compile
for NeXTStep....
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1999-04-11 0:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-04-10 23:49 why doesn't 'source *' work? Timothy J Luoma
1999-04-11 0:22 ` Bruce Stephens
1999-04-11 0:30 ` Timothy J Luoma
-- strict thread matches above, loose matches on Subject: below --
1999-04-10 18:39 Timothy J Luoma
1999-04-10 22:19 ` Bruce Stephens
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).