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

Re: cml invocation vs script output diff



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@xxxxxxxxxxxxxxxxxx> 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.




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