zsh-users
 help / color / mirror / code / Atom feed
* Comprehensive comparison between zsh and bash
@ 2019-07-05 20:01 Peng Yu
  2019-07-05 20:21 ` Eric Cook
  2019-07-05 20:29 ` Ray Andrews
  0 siblings, 2 replies; 6+ messages in thread
From: Peng Yu @ 2019-07-05 20:01 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 581 bytes --]

I’d like to migrate some of my bash scripts to zsh. (Therefore, I don’t
care the difference in the interactive mode.) But there are still many
subtle differences between bash and zsh in the non-interactive part.

Because I’d like to make the migration as painless as possible, it is
better to have a comprehensive list of difference between bash and zsh
along with the functional equivalent code upfront. I don’t find such a
comprehensive list yet. But is there a list that is at least close to
comprehensive to ease the migration?

Thanks.
-- 
Regards,
Peng

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Comprehensive comparison between zsh and bash
  2019-07-05 20:01 Comprehensive comparison between zsh and bash Peng Yu
@ 2019-07-05 20:21 ` Eric Cook
  2019-07-05 20:29 ` Ray Andrews
  1 sibling, 0 replies; 6+ messages in thread
From: Eric Cook @ 2019-07-05 20:21 UTC (permalink / raw)
  To: zsh-users

On 7/5/19 4:01 PM, Peng Yu wrote:
> But is there a list that is at least close to
> comprehensive to ease the migration?
>
> Thanks.
>

Nope.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Comprehensive comparison between zsh and bash
  2019-07-05 20:01 Comprehensive comparison between zsh and bash Peng Yu
  2019-07-05 20:21 ` Eric Cook
@ 2019-07-05 20:29 ` Ray Andrews
  2019-07-06  2:31   ` Phil Pennock
  2019-07-06 12:31   ` Sebastian Gniazdowski
  1 sibling, 2 replies; 6+ messages in thread
From: Ray Andrews @ 2019-07-05 20:29 UTC (permalink / raw)
  To: zsh-users

On 2019-07-05 1:01 p.m., Peng Yu wrote:
> I’d like to migrate some of my bash scripts to zsh. (Therefore, I don’t
> care the difference in the interactive mode.) But there are still many
> subtle differences between bash and zsh in the non-interactive part.

Just curious:  Is there some way of dumping the state of all variables 
at all lines with both bash and zsh to some file or other such that one 
could quickly spot exactly when and where something might change between 
them?  Not a proactive, analytic study of the code, but just a pragmatic 
finding of differences after the fact.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Comprehensive comparison between zsh and bash
  2019-07-05 20:29 ` Ray Andrews
@ 2019-07-06  2:31   ` Phil Pennock
  2019-07-06 14:23     ` Ray Andrews
  2019-07-06 12:31   ` Sebastian Gniazdowski
  1 sibling, 1 reply; 6+ messages in thread
From: Phil Pennock @ 2019-07-06  2:31 UTC (permalink / raw)
  To: Ray Andrews; +Cc: zsh-users

On 2019-07-05 at 13:29 -0700, Ray Andrews wrote:
> Just curious:  Is there some way of dumping the state of all variables at
> all lines with both bash and zsh to some file or other such that one could
> quickly spot exactly when and where something might change between them? 
> Not a proactive, analytic study of the code, but just a pragmatic finding of
> differences after the fact.

`typeset -p` dumps all variables; the format differs slightly between
shells but that's light text-munging to normalize.

This is probably a good start:

    trap 'typeset -p' DEBUG

although I'm not going to promise that the DEBUG hook is invoked in
exactly the same circumstances in each shell.  But that should get you
going.  It will be voluminous.

You might consider:

    mkdir -m 0700 -p "$HOME/traces"
    exec 4>"$HOME/traces/$$.log"
    trap 'typeset -p >&4' DEBUG

You could use `set -x` too, to see the commands being run, but while
bash has `BASH_XTRACEFD`, I don't think zsh has anything quite like
that.  So you're going to lose stderr, or accept differences.

-Phil

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Comprehensive comparison between zsh and bash
  2019-07-05 20:29 ` Ray Andrews
  2019-07-06  2:31   ` Phil Pennock
@ 2019-07-06 12:31   ` Sebastian Gniazdowski
  1 sibling, 0 replies; 6+ messages in thread
From: Sebastian Gniazdowski @ 2019-07-06 12:31 UTC (permalink / raw)
  To: Ray Andrews; +Cc: Zsh Users

On Fri, 5 Jul 2019 at 22:31, Ray Andrews <rayandrews@eastlink.ca> wrote:
> Just curious:  Is there some way of dumping the state of all variables
> at all lines with both bash and zsh to some file or other such that one
> could quickly spot exactly when and where something might change between
> them?  Not a proactive, analytic study of the code, but just a pragmatic
> finding of differences after the fact.

Maybe this plugin could help? https://github.com/psprint/zsnapshot

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Comprehensive comparison between zsh and bash
  2019-07-06  2:31   ` Phil Pennock
@ 2019-07-06 14:23     ` Ray Andrews
  0 siblings, 0 replies; 6+ messages in thread
From: Ray Andrews @ 2019-07-06 14:23 UTC (permalink / raw)
  To: zsh-users

On 2019-07-05 7:31 p.m., Phil Pennock wrote:
> On 2019-07-05 at 13:29 -0700, Ray Andrews wrote:
>> Just curious:  Is there some way of dumping the state of all variables at
>> all lines with both bash and zsh to some file or other such that one could
>> quickly spot exactly when and where something might change between them?
>> Not a proactive, analytic study of the code, but just a pragmatic finding of
>> differences after the fact.
> `typeset -p` dumps all variables; the format differs slightly between
> shells but that's light text-munging to normalize.
>
> This is probably a good start:
>
>      trap 'typeset -p' DEBUG

Thanks Phil and Sebastian.  I have no need for it myself since I've 
never done a thing in bash, but I was wondering what might be available 
to converts.  I'll play with your suggestions anyway tho just for fun.  
But since all the other shells are moribund it seems to me that zsh 
should make an effort to draw all shellers to itself and to make room 
around the fire for them.  It would add to critical mass and maybe spark 
some innovation.  Maybe there could be some purpose build conversion 
utilities.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-07-06 14:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-05 20:01 Comprehensive comparison between zsh and bash Peng Yu
2019-07-05 20:21 ` Eric Cook
2019-07-05 20:29 ` Ray Andrews
2019-07-06  2:31   ` Phil Pennock
2019-07-06 14:23     ` Ray Andrews
2019-07-06 12:31   ` Sebastian Gniazdowski

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).