* cml invocation vs script output diff
@ 2021-01-05 2:46 jdh
2021-01-07 15:51 ` Daniel Shahaf
0 siblings, 1 reply; 3+ messages in thread
From: jdh @ 2021-01-05 2:46 UTC (permalink / raw)
To: zsh-users
zsh vers: zsh 5.8 (x86_64-pc-linux-gnu)
Bug: Different results from command line, cml invocation, versus a zsh script file.
Test case to demostrate this follows:
I don't think that zsh is descending down into . prefixed directories in the script version even with a explict -a given as ls's argument.
---------
mkdir .hiddendir
touch .hiddendir/tilde-file~
ls **/*~ Recursively find all tilde ending filenames starting with the cwd.
This above works as it should, but,
echo '#! /bin/zsh \n ls **/*~' >lstildefiles
chmod 700 lstildefiles
./lsttildefiles
Doesn't work and returns:
$ ./lstildefiles:2: no matches found: **/*~
This shouldn't happen. Why does invoking the same command with the same agrumetns from within a script and the command line differ. The script version is clearly not functioning properly in my opinion. But I can't figure out why. ?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: cml invocation vs script output diff
2021-01-05 2:46 cml invocation vs script output diff jdh
@ 2021-01-07 15:51 ` Daniel Shahaf
2021-01-07 23:09 ` jdh
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Shahaf @ 2021-01-07 15:51 UTC (permalink / raw)
To: jdh; +Cc: zsh-users
jdh wrote on Tue, Jan 05, 2021 at 10:46:13 +0800:
>
> zsh vers: zsh 5.8 (x86_64-pc-linux-gnu)
>
>
> Bug: Different results from command line, cml invocation, versus a zsh script file.
> Test case to demostrate this follows:
>
> I don't think that zsh is descending down into . prefixed directories in the script version even with a explict -a given as ls's argument.
>
> ---------
>
> mkdir .hiddendir
> touch .hiddendir/tilde-file~
>
> ls **/*~ Recursively find all tilde ending filenames starting with the cwd.
>
> This above works as it should, but,
>
> echo '#! /bin/zsh \n ls **/*~' >lstildefiles
> chmod 700 lstildefiles
> ./lsttildefiles
>
> Doesn't work and returns:
>
> $ ./lstildefiles:2: no matches found: **/*~
>
>
> This shouldn't happen. Why does invoking the same command with the same agrumetns from within a script and the command line differ. The script version is clearly not functioning properly in my opinion. But I can't figure out why. ?
Probably your zshrc sets the GLOB_DOTS option. zshrc isn't used by scripts,
only by interactive shells. Diff the output of `setopt` (without arguments)
between the two cases.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: cml invocation vs script output diff
2021-01-07 15:51 ` Daniel Shahaf
@ 2021-01-07 23:09 ` jdh
0 siblings, 0 replies; 3+ messages in thread
From: jdh @ 2021-01-07 23:09 UTC (permalink / raw)
To: Daniel Shahaf; +Cc: zsh-users
Yes, you're right. It was due to .zshrc not being sourced from a script.
Setting the GLOB_DOTS option fixed the problem.
Thanks
Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> jdh wrote on Tue, Jan 05, 2021 at 10:46:13 +0800:
> >
> > zsh vers: zsh 5.8 (x86_64-pc-linux-gnu)
> >
> >
> > Bug: Different results from command line, cml invocation, versus a zsh script file.
> > Test case to demostrate this follows:
> >
> > I don't think that zsh is descending down into . prefixed directories in the script version even with a explict -a given as ls's argument.
> >
> > ---------
> >
> > mkdir .hiddendir
> > touch .hiddendir/tilde-file~
> >
> > ls **/*~ Recursively find all tilde ending filenames starting with the cwd.
> >
> > This above works as it should, but,
> >
> > echo '#! /bin/zsh \n ls **/*~' >lstildefiles
> > chmod 700 lstildefiles
> > ./lsttildefiles
> >
> > Doesn't work and returns:
> >
> > $ ./lstildefiles:2: no matches found: **/*~
> >
> >
> > This shouldn't happen. Why does invoking the same command with the same agrumetns from within a script and the command line differ. The script version is clearly not functioning properly in my opinion. But I can't figure out why. ?
>
> Probably your zshrc sets the GLOB_DOTS option. zshrc isn't used by scripts,
> only by interactive shells. Diff the output of `setopt` (without arguments)
> between the two cases.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-07 23:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05 2:46 cml invocation vs script output diff jdh
2021-01-07 15:51 ` Daniel Shahaf
2021-01-07 23:09 ` jdh
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).