Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I enjoy some cool macos tricks, but the bash substitution was something I had never seen!

Very neat, I looked into it briefly and it looks like using {@%.*} is not posix compliant, but a bashism. However the substitution itself is posix compliant, so I may start using something like this in my scripts. Need to look at this more, but this is a heck of a lot less clunky than `echo | sed`... I need to go read `info coreutils` more closely.....



${@%.*} is valid in both bash (old macOS default shell) and zsh (current macOS default shell).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: