4 ms·
That's also one of the more notable incompatibilities of zsh - by default it treats $a the same as "$a", and you're supposed to use arrays if you want multiple
by unnah 2y ago
That's also one of the more notable incompatibilities of zsh - by default it treats $a the same as "$a", and you're supposed to use arrays if you want multiple words. Although I'm not an expert - maybe ysh and zsh differ in the details here?
- chubot 2y agoYup, in terms of ls $a -- YSH happens to be like zsh. OSH is compatible with bash and does the POSIX word splitting, but YSH is not. In general YSH is pretty different than zsh though -- it's more of a Python- JS-like language with structured data, e.g. ysh$ var a = ['list', 'of' strings'] ysh$ write -- @a list of strings In zsh I still think that's the pretty obscure "${a[@]}" rather than @a. Arrays are also "flat" in zsh -- you can't have an array of arrays, because there's no garbage collector. But YSH has arbitrarily nested JSON-like data structures, and JSON serialization built in. I need to put some code examples on the home page, but for now - https://www.oilshell.org/release/latest/doc/ysh-tour.html https://www.oilshell.org/release/latest/doc/ysh-tour.html
- arp242 2y agoYou can use $=a to get word splitting in zsh. While incompatible, the zsh behaviour makes a lot more sense. You can use "setopt sh_word_split" to get the POSIX behaviour. Or split explicitly with ${(s: :)a}, ${(s:SPLIT-ON-THIS:)a}, etc. (not compatible with anything but zsh).