Comment

Comment by cb321

As many others here have noted, terse syntax for things like `repeat` loops or normal `for`/`while` loops or shell var expansion can all be addictive, but some specific things I miss in Bash that are easy in Zsh are:

    1) auto cd to any evar just from its name
       e.g. lb=/usr/local/bin; lb
       ($lb works in bash, but I always forget
       the $.  I know I could do aliases...Yuck.)

    2) auto cd does not seem to use $CDPATH
       this is a real pain since I am used to
       never typing "cd ".

    3) **c instead of **/*c for a recursive glob
       At 2 vs. 4 chars (or 3 vs. 6 keydowns) it
       may not *look* much briefer, but it feels
       much easier to type once you're used to it.

    4) On the fly command line colorization along
       the lines of zsh-syntax-highlighting.
       Spot syntax errors/missing cmds *before*
       you hit <ENTER>.

    5) vared MyVar
       Use the ZLE to easily modify any evar.

    6) Zsh's REPORTTIME
       *automatically* report time/memory of only
       "expensive" programs/pipelines.

    7) Zsh's extended history format that includes
       both the time started as well as *duration*
       of all my commands.

    8) Floating point arithmetic and $[]
       forget all this calculator jazz.  I just
       do `alias ec=echo` and go `ec $[1234./56]`
       or even just : $[1234./56]<TAB>

    9) glob qualifiers (forget `find` or `fd`)
       My main use cases are *(.) *(@) & *(/),
       sometimes with a ^ for "not" in there,
       e.g. *(^/).  The codes are mostly the
       old ls -F codes to be easy to recall.
If anyone knows how to make Bash do any of those, I would appreciate the tip. Otherwise, maybe they count as "killer" features to someone.

Also, I tend to use a global alias "/n" for "/dev/null". I know I could just use $n with n=/dev/null, but I enjoy having it look like a path in / that never actually exists.

parent cb321 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton