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

is there a reason "cd && pwd" is preferred over `realpath`?


mac doesn't have realpath command.


or a modern bash built in (grrrr)


In fairness, macOS has switched over to zsh as of 1 year ago in macOS Catalina: https://support.apple.com/en-us/HT208050.

Catalina shipped with zsh 5.7 whereas 5.8 is now the latest.


My gripe is about being able to work on a bash script that needs to work "everywhere". Bash 4 was release over a decade ago, so it's a reasonable expectation that it will be present on most servers with a shell.

Homebrew works around that, but their refusal over GPL taint for having the binary present still doesn't seem right.


What about to use zsh to run bash script on mac? Possibly it's better than old bash.


That may cause errors or undesirable behaviour. As way of example, dealing with arrays: `read -a` in bash is `read -A` in zsh, and the former’s arrays are zero-based while the latter’s are one-based.


Big Sur ships with zsh 5.8 as /bin/zsh.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: