this post was submitted on 13 Jun 2023
5 points (100.0% liked)

Shell Scripting

1368 readers
1 users here now

From Ash, Bash and Csh to Xonsh, Ysh and Zsh; all shell languages are welcome here!

Rules:
  1. Follow Lemmy rules!
  2. Posts must relate to shell scripting. (See bottom of sidebar for more information.)
  3. Only make helpful replies to questions. This is not the place for low effort joke answers.
  4. No discussion about piracy or hacking.
  5. If you find a solution to your problem by other means, please take your time to write down the steps you used to solve your problem in the original post. You can potentially help others having the same problem!
  6. These rules will change as the community grows.

Keep posts about shell scripting! Here are some guidelines to help:


In general, if your submission text is primarily shell code, then it is welcome here!

founded 2 years ago
MODERATORS
5
[ysh] (1/3) Reviewing YSH (www.oilshell.org)
submitted 2 years ago* (last edited 2 years ago) by gamma to c/shell
 

YSH, or the shell formally known as oil, is touted as a possible upgrade path from Bash.

This is the first in a three-part series of posts re-introducing the language.

  1. Reviewing YSH (you are here)
  2. Sketches of YSH Features
  3. YSH, Narrow Waists, and Perlis-Thompson Problems (Not yet released)
top 4 comments
sorted by: hot top controversial new old
[–] gamma 1 points 2 years ago* (last edited 2 years ago) (1 children)

I need to disclaim that I am not affiliated with the project, and have actually been pretty critical of it in the past. But I tend to agree with the author's reasoning across most of the blog, so I believe there is real merit to the shell.

Who knows, maybe in a few years we'll all be writing YSH!

[–] howarddo 1 points 2 years ago* (last edited 2 years ago) (1 children)

At what is this better than zsh, bash or fish? What make u switch to ysh?

[–] gamma 2 points 2 years ago

I haven't switched to ysh. I personally use Zsh for my interactive shell, but I write my scripts in a variety of shells.

You can start with Ysh in its Bash-compatible mode, individually enable new features with shopt. Those features include:

  • Not splitting or globbing $foo by default (this is shared by Zsh and Fish)
  • A Python-inpsired parsing mode, which should supersede arithmetic mode (induced by ( ) in tests, $[ ] for string splicing and @[ ] for array splicing)
  • Strucutred data
  • New functions which return structured data (Oil calls classic shell functions "procs", because they behave a lot like external programs with extra side effects)
  • cd to/somewhere { echo $PWD;}
[–] [email protected] 1 points 2 years ago

I'm interested in it. It claims to be quite a bit faster but I'm curious as to how practical it is.