New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dirname replacement #9
Comments
The two are often interchangable, but in this case, for paths with trailing slashes, and in your unquoted case when the invoked name contains whitespace, the results are not identical. dirname and basename handle some edge cases well, even though it's slower and harder to use right. I'll keep it mind and see how helpful this suggestion actually is. PS: dirname $0 is not a reliable way of getting the directory the script is in. In particular it fails when you invoke the script from $PATH. |
I also think the checks on basename and dirname may be a bit aggressive |
Added unique package name constraint
I'm not entirely sure if this is a bug, so please forgive me if it's a problem with my script instead
shellcheck suggests that i replace "dirname$0" with "$ {var%/*}"
however, when i run the script with "bash scriptname" or "sh scriptname", the parameter expansion does not result in the same string:
dirname: "."
parameter expansion: "scriptname"
hope that helps
The text was updated successfully, but these errors were encountered: