4 ms·
zsh's killer feature for me was "splat splat" and the extended shell globbing; `<splat><splat>/foo<splat>(.x)` type stuff. Replaced `find` for a lot of my inte
by michaelcampbell 6y ago
zsh's killer feature for me was "splat splat" and the extended shell globbing; `<splat><splat>/foo<splat>(.x)` type stuff. Replaced `find` for a lot of my interactive stuff, although I do use `find ... -print0 | xargs -0r ...` for a lot of things yet.
I do realize `bash` also has `splat splat`, now.
(curse HN's splat/star pseudo-markup)
- thiht 6y agoWhat's splat splat?
- ktpsns 6y agoAn asterisk character (star). Hackernews Wickes up this character.
- kaszanka 6y agoDoes escaping work? \\ It doesn't, that's interesting. *a*b*c*d* Looks like a code block is the only option.
- deleted 6y ago[deleted]
- oftenwrong 6y agoRecursive glob: ** You can enable it on recent versions of bash with: shopt -s globstar
- Symbiote 6y agoI write scripts which don't need to be portable using Zsh, and I find it very useful for interactive use too. If I'm handling a lot of files/file formats, the parameter expansion flags are very useful: for i in (#i)*.png~*orig*(oL); convert $i $i:r:l.jpg That's a (#i) case-insensitive match for ∗.png, but excluding ~ files matching ∗orig∗, and (oL) ordered by length/size. The $i:r strips the final file extension (i.e. .png), and the :l downcases the filename. x=( DSC_<0450-0630>.JPG ) some-command -A${^x} Runs: some-command -ADSC_0450.JPG -ADSC_0451.JPG -ADSC_0452.JPG … x is set to an array matching files like DSC_0500.JPG, where the number is in the range 0450-0630. The -A${^x} expands the array, prefixing each entry with -A. ls -l **/src/**/*(.x) Recursively list all plain files (.) that are executable (x), and where the directory "src" is somewhere in the path. Have a look at "man zshexpn" (then "Parameter Expansion") or [1], then "Filename Generation" further down. 30 minutes reading this is worthwhile for anyone who uses Zsh regularly. [1] http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parame...
- LukeShu 6y ago> I do realize `bash` also has `splat splat`, now. To put a date on that: Since Bash 4.0 in 2009. Which is ~forever since you tried zsh in 1993, but is also ~forever ago now. As for when zsh got it: It had "..../" in 2.0 (maybe before), that got changed to "<four splats>/" in 2.1.0 (1992?), and that got shortened to "<two splats>/" in 2.2.0 (1996?).