3 ms·
Every time I see this I can't help but smile, knowing that in Zsh the equivalent code is: #!/usr/bin/env zsh setopt err_exit no_unset DIR=${0:h}
by nerdponx 6y ago
Every time I see this I can't help but smile, knowing that in Zsh the equivalent code is:
#!/usr/bin/env zsh
setopt err_exit no_unset
DIR=${0:h}
- lukeschlather 6y agoHonestly I think I prefer the bash version to `DIR=${0:h}`. Although Powershell is superior with simply "$PSScriptRoot" (On the other hand, Powershell's strict mode is a mess and "catch errors" in Powershell is still an extra setting that doesn't actually catch errors half the time.)
- rhencke 6y agoIf you like that, you'll love working with PowerShell's exit codes. [1] [2] [3] [1] https://weblogs.asp.net/soever/returning-an-exit-code-from-a-powershell-script https://weblogs.asp.net/soever/returning-an-exit-code-from-a... [2] https://octopus.com/blog/powershell-exit-codes https://octopus.com/blog/powershell-exit-codes [3] https://community.idera.com/database-tools/powershell/powertips/b/tips/posts/correctly-returning-exit-codes https://community.idera.com/database-tools/powershell/powert...
- nerdponx 6y agoOut of curiosity, what do you like better about the Bash version?
- kwhitefoot 6y agoNot the OP. For the occasional user, like me, it is more obvious what it is doing.