* Re: Does zsh have an equivalent to the shopt command ?
[not found] ` <200607221508.k6MF8W0w002651@pwslaptop.csr.com>
@ 2006-07-24 7:44 ` Sean
2006-07-24 10:01 ` Peter Stephenson
0 siblings, 1 reply; 15+ messages in thread
From: Sean @ 2006-07-24 7:44 UTC (permalink / raw)
To: Peter Stephenson, zsh-users
Peter,
On futher investigation, it appears that it is not actually choking on
that line, rather this code which appears in many of the case option
function calls:
version() { sed -e 's/^ //' <<EndVersion
TODO.TXT Manager
Version 1.6.3
Author: Gina Trapani (ginatrapani@gmail.com)
Release date: 5/11/2006
Last updated: 7/6/2006
License: GPL, http://www.gnu.org/copyleft/gpl.html
More information and mailing list at http://todotxt.com
EndVersion
exit 1
}
On 7/23/06, Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> That's absolutely standard shell code which should work fine everywhere.
> What's the context? What's the actual error? Could "getopts", or even
> "while", have been replaced by a function?
>
> I suggest posting to the list in case anyone has suggestions.
>
> pws
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does zsh have an equivalent to the shopt command ?
2006-07-24 7:44 ` Does zsh have an equivalent to the shopt command ? Sean
@ 2006-07-24 10:01 ` Peter Stephenson
2006-07-24 11:23 ` Sean
0 siblings, 1 reply; 15+ messages in thread
From: Peter Stephenson @ 2006-07-24 10:01 UTC (permalink / raw)
To: zsh-users
Sean wrote:
> On futher investigation, it appears that it is not actually choking on
> that line, rather this code which appears in many of the case option
> function calls:
>
> version() { sed -e 's/^ //' <<EndVersion
> TODO.TXT Manager
> Version 1.6.3
> Author: Gina Trapani (ginatrapani@gmail.com)
> Release date: 5/11/2006
> Last updated: 7/6/2006
> License: GPL, http://www.gnu.org/copyleft/gpl.html
> More information and mailing list at http://todotxt.com
> EndVersion
> exit 1
> }
Hmmm... again, that should work fine and does on my machine; the
shell isn't asked to do anything much beyond parsing a here document.
When you say "chokes", what do you mean? Obviously calling the
function will cause the shell to exit, because of the "exit 1" at the
end ; is it failing to print the message, exiting in some odd way,
hanging...? Or are you saying the options to the parent function (with
the getopts) are such that this function shouldn't be called? In which
case, what combination of options to that function is causing unexpected
behaviour? (I could believe getopts behaved differently from bash but I
need to see the command line being passed.)
I'm guessing a lot of the spaces in that function were actually
tabs, but I've put those back and not had any problem.
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does zsh have an equivalent to the shopt command ?
2006-07-24 10:01 ` Peter Stephenson
@ 2006-07-24 11:23 ` Sean
2006-07-24 11:35 ` Lloyd Zusman
2006-07-24 11:38 ` Peter Stephenson
0 siblings, 2 replies; 15+ messages in thread
From: Sean @ 2006-07-24 11:23 UTC (permalink / raw)
To: Peter Stephenson; +Cc: zsh-users
The message fails to print and the shell hangs !
On 7/24/06, Peter Stephenson <pws@csr.com> wrote:
> Sean wrote:
> > On futher investigation, it appears that it is not actually choking on
> > that line, rather this code which appears in many of the case option
> > function calls:
> >
> > version() { sed -e 's/^ //' <<EndVersion
> > TODO.TXT Manager
> > Version 1.6.3
> > Author: Gina Trapani (ginatrapani@gmail.com)
> > Release date: 5/11/2006
> > Last updated: 7/6/2006
> > License: GPL, http://www.gnu.org/copyleft/gpl.html
> > More information and mailing list at http://todotxt.com
> > EndVersion
> > exit 1
> > }
>
> Hmmm... again, that should work fine and does on my machine; the
> shell isn't asked to do anything much beyond parsing a here document.
> When you say "chokes", what do you mean? Obviously calling the
> function will cause the shell to exit, because of the "exit 1" at the
> end ; is it failing to print the message, exiting in some odd way,
> hanging...? Or are you saying the options to the parent function (with
> the getopts) are such that this function shouldn't be called? In which
> case, what combination of options to that function is causing unexpected
> behaviour? (I could believe getopts behaved differently from bash but I
> need to see the command line being passed.)
>
> I'm guessing a lot of the spaces in that function were actually
> tabs, but I've put those back and not had any problem.
>
> --
> Peter Stephenson <pws@csr.com> Software Engineer
> CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
> Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
>
>
> To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does zsh have an equivalent to the shopt command ?
2006-07-24 11:23 ` Sean
@ 2006-07-24 11:35 ` Lloyd Zusman
2006-07-24 11:38 ` Peter Stephenson
1 sibling, 0 replies; 15+ messages in thread
From: Lloyd Zusman @ 2006-07-24 11:35 UTC (permalink / raw)
To: zsh-users
Sean <schliden@gmail.com> writes:
> The message fails to print and the shell hangs !
Could you post your entire script?
> On 7/24/06, Peter Stephenson <pws@csr.com> wrote:
>> Sean wrote:
>> > On futher investigation, it appears that it is not actually choking on
>> > that line, rather this code which appears in many of the case option
>> > function calls:
>> >
>> > version() { sed -e 's/^ //' <<EndVersion
>> > TODO.TXT Manager
>> > Version 1.6.3
>> > Author: Gina Trapani (ginatrapani@gmail.com)
>> > Release date: 5/11/2006
>> > Last updated: 7/6/2006
>> > License: GPL, http://www.gnu.org/copyleft/gpl.html
>> > More information and mailing list at http://todotxt.com
>> > EndVersion
>> > exit 1
>> > }
>>
>> Hmmm... again, that should work fine and does on my machine; the
>> shell isn't asked to do anything much beyond parsing a here document.
>> When you say "chokes", what do you mean? Obviously calling the
>> function will cause the shell to exit, because of the "exit 1" at the
>> end ; is it failing to print the message, exiting in some odd way,
>> hanging...? Or are you saying the options to the parent function (with
>> the getopts) are such that this function shouldn't be called? In which
>> case, what combination of options to that function is causing unexpected
>> behaviour? (I could believe getopts behaved differently from bash but I
>> need to see the command line being passed.)
>>
>> I'm guessing a lot of the spaces in that function were actually
>> tabs, but I've put those back and not had any problem.
>>
>> --
>> Peter Stephenson <pws@csr.com> Software Engineer
>> CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
>> Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
>>
>>
>> To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
>>
>
--
Lloyd Zusman
ljz@asfast.com
God bless you.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does zsh have an equivalent to the shopt command ?
2006-07-24 11:23 ` Sean
2006-07-24 11:35 ` Lloyd Zusman
@ 2006-07-24 11:38 ` Peter Stephenson
2006-07-27 3:38 ` Sean
1 sibling, 1 reply; 15+ messages in thread
From: Peter Stephenson @ 2006-07-24 11:38 UTC (permalink / raw)
To: zsh-users
Sean wrote:
> The message fails to print and the shell hangs !
I can't reproduce that. What happens if you run the sed (and its
here-document) from the command line, or by running ". file" on a file
that contains only the sed command? Could the path to "sed" be wrong?
pws
To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does zsh have an equivalent to the shopt command ?
2006-07-24 11:38 ` Peter Stephenson
@ 2006-07-27 3:38 ` Sean
2006-07-27 9:18 ` Lloyd Zusman
2006-07-27 10:17 ` Peter Stephenson
0 siblings, 2 replies; 15+ messages in thread
From: Sean @ 2006-07-27 3:38 UTC (permalink / raw)
To: Peter Stephenson; +Cc: zsh-users
Sorry for the slow reply... wife's birthdays seems to take preceedence :^)
I can run sed from the command line ok, and all of the other sed stuff
in the script works.
It seems to be something to do with processing these text blocks:
<<EndVersion
EndVersion
<<EndHelp
EndHelp
<<Endusage
EndUsage
I have tried saving these in seperate files and running them but zsh
crashes immeadiately, without outputting a single line.
What does: -e 's/^ //' do anyway ?
Perhaps I can work around this with a different approach.
Cheers
Sean
On 7/24/06, Peter Stephenson <pws@csr.com> wrote:
> Sean wrote:
> > The message fails to print and the shell hangs !
>
> I can't reproduce that. What happens if you run the sed (and its
> here-document) from the command line, or by running ". file" on a file
> that contains only the sed command? Could the path to "sed" be wrong?
>
> pws
>
>
> To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does zsh have an equivalent to the shopt command ?
2006-07-27 3:38 ` Sean
@ 2006-07-27 9:18 ` Lloyd Zusman
2006-07-27 15:12 ` john_oshea
2006-07-28 0:25 ` Sean
2006-07-27 10:17 ` Peter Stephenson
1 sibling, 2 replies; 15+ messages in thread
From: Lloyd Zusman @ 2006-07-27 9:18 UTC (permalink / raw)
To: zsh-users
Sean <schliden@gmail.com> writes:
> Sorry for the slow reply... wife's birthdays seems to take preceedence :^)
>
> I can run sed from the command line ok, and all of the other sed stuff
> in the script works.
>
> It seems to be something to do with processing these text blocks:
>
> <<EndVersion
> EndVersion
>
> <<EndHelp
> EndHelp
>
> <<Endusage
> EndUsage
>
> I have tried saving these in seperate files and running them but zsh
> crashes immeadiately, without outputting a single line.
>
> What does: -e 's/^ //' do anyway ?
>
> Perhaps I can work around this with a different approach.
>
> Cheers
>
> Sean
Again, could you post the entire script, from top to bottom? It will be
easier to help you with this if you do so.
The "-e ..." stuff you mention above strips the leading whitespace out
of the lines within the here document, e.g., between "<<EndVersion" and
"EndVersion".
>
> On 7/24/06, Peter Stephenson <pws@csr.com> wrote:
>> Sean wrote:
>> > The message fails to print and the shell hangs !
>>
>> I can't reproduce that. What happens if you run the sed (and its
>> here-document) from the command line, or by running ". file" on a file
>> that contains only the sed command? Could the path to "sed" be wrong?
>>
>> pws
>>
>>
>> To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
>>
>
--
Lloyd Zusman
ljz@asfast.com
God bless you.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does zsh have an equivalent to the shopt command ?
2006-07-27 3:38 ` Sean
2006-07-27 9:18 ` Lloyd Zusman
@ 2006-07-27 10:17 ` Peter Stephenson
1 sibling, 0 replies; 15+ messages in thread
From: Peter Stephenson @ 2006-07-27 10:17 UTC (permalink / raw)
To: zsh-users
Sean wrote:
> I can run sed from the command line ok, and all of the other sed stuff
> in the script works.
>
> It seems to be something to do with processing these text blocks:
>
> <<EndVersion
> EndVersion
I have no idea what could be causing that and it doesn't happen on
anyway of the Cygwin versions I've tried.
Is it still the case that
>I am running the windows port of zsh (ver 3.0.5) supplied with unixkit-tiny.
? I suspect there might be something wrong with this port. (3.0.5 is
now rather old, but I still don't remember any problem of this kind
in any version I've seen.)
If you don't mind exploring other avenues, you can change
version() { sed -e 's/^ //' <<EndVersion
TODO.TXT Manager
Version 1.6.3
Author: Gina Trapani (ginatrapani@gmail.com)
Release date: 5/11/2006
Last updated: 7/6/2006
License: GPL, http://www.gnu.org/copyleft/gpl.html
More information and mailing list at http://todotxt.com
EndVersion
exit 1
}
to
version() { sed -e 's/^ //' <<<"\
TODO.TXT Manager
Version 1.6.3
Author: Gina Trapani (ginatrapani@gmail.com)
Release date: 5/11/2006
Last updated: 7/6/2006
License: GPL, http://www.gnu.org/copyleft/gpl.html
More information and mailing list at http://todotxt.com"
exit 1
}
This ought to work, since it relies on basic shell parsing rather
than a special chunk of I/O. Note, however, that it's non-standard.
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does zsh have an equivalent to the shopt command ?
2006-07-27 9:18 ` Lloyd Zusman
@ 2006-07-27 15:12 ` john_oshea
2006-07-28 0:25 ` Sean
1 sibling, 0 replies; 15+ messages in thread
From: john_oshea @ 2006-07-27 15:12 UTC (permalink / raw)
To: zsh-users
Lloyd Zusman wrote:
> Again, could you post the entire script, from top to bottom? It will be
> easier to help you with this if you do so.
<butting in slightly> The script is one that's been featured on
LifeHacker, and is the todo.sh one from <http://todotxt.com/> - it's
12K, so possibly a bit big for inlining to the list(?)
FWIW, the same script is working fine on my setup (zsh 4.2.3/OSX 10.4.7)
--
John O'Shea, VP Technical Strategy
Wordbank Limited
33 Charlotte Street, London W1T 1RR
Direct line: +44 (0) 20 7903 8829
Fax: +44 (0) 20 7903 8888
<http://www.wordbank.com/>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does zsh have an equivalent to the shopt command ?
2006-07-27 9:18 ` Lloyd Zusman
2006-07-27 15:12 ` john_oshea
@ 2006-07-28 0:25 ` Sean
1 sibling, 0 replies; 15+ messages in thread
From: Sean @ 2006-07-28 0:25 UTC (permalink / raw)
To: Lloyd Zusman; +Cc: zsh-users
As Lloyd pointed out, the script is a little long to post inline, but
is available here:
http://todotxt.com/download/todo.sh
Peter, I tried your replacement suggestion, but it also (after a long
think) crashed zsh.
I have come up with this brilliant fix:
version()
{
echo "TODO.TXT Manager
Version 1.7.1
Author: Gina Trapani (ginatrapani@gmail.com)
Release date: 5/11/2006
Last updated: 7/20/2006
License: GPL, http://www.gnu.org/copyleft/gpl.html
More information and mailing list at http://todotxt.com"
exit 1
}
Cheers
Sean
On 7/27/06, Lloyd Zusman <ljz@asfast.com> wrote:
> Sean <schliden@gmail.com> writes:
>
> > Sorry for the slow reply... wife's birthdays seems to take preceedence :^)
> >
> > I can run sed from the command line ok, and all of the other sed stuff
> > in the script works.
> >
> > It seems to be something to do with processing these text blocks:
> >
> > <<EndVersion
> > EndVersion
> >
> > <<EndHelp
> > EndHelp
> >
> > <<Endusage
> > EndUsage
> >
> > I have tried saving these in seperate files and running them but zsh
> > crashes immeadiately, without outputting a single line.
> >
> > What does: -e 's/^ //' do anyway ?
> >
> > Perhaps I can work around this with a different approach.
> >
> > Cheers
> >
> > Sean
>
> Again, could you post the entire script, from top to bottom? It will be
> easier to help you with this if you do so.
>
> The "-e ..." stuff you mention above strips the leading whitespace out
> of the lines within the here document, e.g., between "<<EndVersion" and
> "EndVersion".
>
>
> >
> > On 7/24/06, Peter Stephenson <pws@csr.com> wrote:
> >> Sean wrote:
> >> > The message fails to print and the shell hangs !
> >>
> >> I can't reproduce that. What happens if you run the sed (and its
> >> here-document) from the command line, or by running ". file" on a file
> >> that contains only the sed command? Could the path to "sed" be wrong?
> >>
> >> pws
> >>
> >>
> >> To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
> >>
> >
>
> --
> Lloyd Zusman
> ljz@asfast.com
> God bless you.
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does zsh have an equivalent to the shopt command ?
2006-07-22 2:16 ` Sean
@ 2006-07-22 10:36 ` Peter Stephenson
0 siblings, 0 replies; 15+ messages in thread
From: Peter Stephenson @ 2006-07-22 10:36 UTC (permalink / raw)
To: zsh-users, pws
Sean wrote:
> Thanks for the help with setopt.
>
> I am also having a problem with this line in a script:
>
> while getopts ":fhpqvVd:" Option
That should work fine; what's the code in the loop and what problem are
you seeing?
--
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does zsh have an equivalent to the shopt command ?
2006-07-20 9:47 ` Peter Stephenson
@ 2006-07-22 2:16 ` Sean
2006-07-22 10:36 ` Peter Stephenson
0 siblings, 1 reply; 15+ messages in thread
From: Sean @ 2006-07-22 2:16 UTC (permalink / raw)
To: zsh-users
Thanks for the help with setopt.
I am also having a problem with this line in a script:
while getopts ":fhpqvVd:" Option
again, zsh chokes on this.
TIA
On 7/20/06, Peter Stephenson <pws@csr.com> wrote:
> Jean-Rene David <jrdavid@magma.ca> wrote:
> > * Sean [2006.07.19 12:45]:
> > > zsh chokes on this line in a script:
> > >
> > > shopt -s extglob
> > >
> > > Is there an alternative for use in zsh ?
> >
> > setopt extendedglob
>
> However, the globbing syntax enabled by bash's extglob option is the
> ksh-style with parentheses introduced by ?, @, *, + or !. If you need
> this syntax in zsh, you should "setopt kshglob".
>
> --
> Peter Stephenson <pws@csr.com> Software Engineer
> CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
> Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
>
>
> To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does zsh have an equivalent to the shopt command ?
2006-07-19 18:06 ` Jean-Rene David
@ 2006-07-20 9:47 ` Peter Stephenson
2006-07-22 2:16 ` Sean
0 siblings, 1 reply; 15+ messages in thread
From: Peter Stephenson @ 2006-07-20 9:47 UTC (permalink / raw)
To: zsh-users
Jean-Rene David <jrdavid@magma.ca> wrote:
> * Sean [2006.07.19 12:45]:
> > zsh chokes on this line in a script:
> >
> > shopt -s extglob
> >
> > Is there an alternative for use in zsh ?
>
> setopt extendedglob
However, the globbing syntax enabled by bash's extglob option is the
ksh-style with parentheses introduced by ?, @, *, + or !. If you need
this syntax in zsh, you should "setopt kshglob".
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Does zsh have an equivalent to the shopt command ?
2006-07-19 16:44 Sean
@ 2006-07-19 18:06 ` Jean-Rene David
2006-07-20 9:47 ` Peter Stephenson
0 siblings, 1 reply; 15+ messages in thread
From: Jean-Rene David @ 2006-07-19 18:06 UTC (permalink / raw)
To: zsh-users
* Sean [2006.07.19 12:45]:
> zsh chokes on this line in a script:
>
> shopt -s extglob
>
> Is there an alternative for use in zsh ?
setopt extendedglob
--
JR
^ permalink raw reply [flat|nested] 15+ messages in thread
* Does zsh have an equivalent to the shopt command ?
@ 2006-07-19 16:44 Sean
2006-07-19 18:06 ` Jean-Rene David
0 siblings, 1 reply; 15+ messages in thread
From: Sean @ 2006-07-19 16:44 UTC (permalink / raw)
To: zsh-users
zsh chokes on this line in a script:
shopt -s extglob
Is there an alternative for use in zsh ?
Thanks
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2006-07-28 0:25 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <96c45c490607220357h2c841b20q506de061f0e6f43b@mail.gmail.com>
[not found] ` <200607221508.k6MF8W0w002651@pwslaptop.csr.com>
2006-07-24 7:44 ` Does zsh have an equivalent to the shopt command ? Sean
2006-07-24 10:01 ` Peter Stephenson
2006-07-24 11:23 ` Sean
2006-07-24 11:35 ` Lloyd Zusman
2006-07-24 11:38 ` Peter Stephenson
2006-07-27 3:38 ` Sean
2006-07-27 9:18 ` Lloyd Zusman
2006-07-27 15:12 ` john_oshea
2006-07-28 0:25 ` Sean
2006-07-27 10:17 ` Peter Stephenson
2006-07-19 16:44 Sean
2006-07-19 18:06 ` Jean-Rene David
2006-07-20 9:47 ` Peter Stephenson
2006-07-22 2:16 ` Sean
2006-07-22 10:36 ` Peter Stephenson
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).