Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Christmas Cheer Linux Idle

Linux Advent Calendar: "24 Outstanding ZSH Gems" 46

First time submitter Manko10 writes "After the Advent series last year, there is again a Linux Advent calender. The topic of this year's Advent series is '24 Outstanding ZSH Gems'. Every day from December 1st until December 24th an article will be published each covering a special feature of the Z Shell you might not have known yet."
This discussion has been archived. No new comments can be posted.

Linux Advent Calendar: "24 Outstanding ZSH Gems"

Comments Filter:
  • Only 24 features? (Score:4, Interesting)

    by Baloroth ( 2370816 ) on Thursday December 01, 2011 @07:37PM (#38233260)

    Well, that'll get you through... what, the first page of the manual?

    The damn thing has a built-in tcp command system (ok, I think it's technically a "module"). The main man page is just a redirect page. Hell, it might even rival emacs for complexity. I know, I didn't think it was possible either...

    • Hell, it might even rival emacs for complexity. I know, I didn't think it was possible either...

      It's not so strange if you think about it. Both are operating systems cleverly disguised as applications, complete with their own programming languages.

      The major difference is that zsh is disguised as a shell, and Emacs is disguised as a text editor.

      I, for one, look forward to the arrival of our minor-mode-wielding zsh overlords.

  • <3 zsh (Score:4, Informative)

    by mirix ( 1649853 ) on Thursday December 01, 2011 @07:42PM (#38233300)

    I wasn't familiar with zsh until I used grml [grml.org] (a fairly handy debian-based live distro, I use for fixing things on occasion). It comes with a pretty spiffy zshrc and zsh by default, which opened me to some of the features of it... pretty nifty... Now I use zsh on everything.

    Some info about grml's use of zsh, here [grml.org].

    • I started using zsh the instant I read about ** globs.

      Bash has them now, but I see little reason to switch back.

    • Yep, I too strongly recommend zsh. The command line completion especially is far, far better than bash. Although you pretty much have to create (or download: there are quite a few good ones online) an extensive zshrc file to use it properly. Thanks for pointing out grml, I might have to look into using that in the future.
  • by serviscope_minor ( 664417 ) on Thursday December 01, 2011 @08:27PM (#38233612) Journal

    Not a ZSH gem, but this is probably the last word in BASH prompts.

    PS1='C:$(echo ${PWD//\//\\\} | tr "[:lower:]" "[:upper:]" |
                              sed -e"s/\\([^\\]\\{6\\}\\)[^\\]\\{2,\\}/\\1~1/g" ) >'

    you'd be wise not to trust random code, but if you look carefully it uses only echo, tr and sed, none of which have programmable IO and only piping, so it is safe.

    • by Anonymous Coward on Thursday December 01, 2011 @08:41PM (#38233716)

      You are evil.

    • by Anonymous Coward

      +1 Nostalgia

      Brings me back to 1996 when Windows was cool.

    • by Anonymous Coward

      I feel ... unclean ...

    • I like how you even used sed to switch up the slashes and break down long names. Now to sneak this into someones bashrc and catch their face when they login...

    • by tqk ( 413719 )

      I don't get it:
      PS1='C:$(echo ${PWD//\//\\\} | tr "[:lower:]" "[:upper:]" | sed -e"s/\\([^\\]\\{6\\}\\)[^\\]\\{2,\\}/\\1~1/g" ) >' xterm
      I got a regular xterm with my regular PS1 prompt. Whoosh?!?

      Aside, I liked both zsh and grml when I used them, but decided neither were necessary and not for me. Besides, unless you're a shell programmer wizard, you're not going to see a lot of differences between bash, ksh, and zsh. They all pretty much function the same at a user level. Well, except for the resources

    • by tlhIngan ( 30335 )

      you'd be wise not to trust random code, but if you look carefully it uses only echo, tr and sed, none of which have programmable IO and only piping, so it is safe.

      Funny enough, I sorta figured out what it did by careful inspection of the line.

      So PS1 gets set to "C:", then the current working directory. Hrm... then TR is used to change all lowercase to upper case, followed by a very peculiar sed. All the while it seems the / are being replaced with \ (\\ for the escaping).

      Since the word "evil" was attached t

  • Here's a gem:

    In my country Shell petrol stations have recently re-branded as: Z

    Co-incidence? I think not.

  • Maybe I'm ill informed since I've only run "Redhatty" distros (SCEfoos wacky Kondara-ized RH6 on the PS2, YDL, and now Fedora) but isn't bash the standard shell for Linux? So wouldn't bash tricks be more useful?

    • I think the trick here is that people who think zsh is a better shell than bash are using this campaign to raise awareness of zsh.

      By the way, I do think zsh is the better shell. Just to name one of the things I love about it: writing custom command completion for it is pretty easy (certainly compared to bash). I and other people have used this to provide tab completion for mostly anything you can think of, including things like command options and filenames on remote machines. Go check it out if you haven't

  • ...I'm seeing a blog. Is there an Advent calendar [typepad.com] somewhere that I'm missing?

Single tasking: Just Say No.

Working...