Sample Header Ad - 728x90

shellcheck is advising not to use basename: why?

29 votes
3 answers
2466 views
I am trying out shellcheck . I have something like that basename "${OPENSSL}" and I get the following suggestion Use parameter expansion instead, such as ${var##*/}. From the practical point of view I see no difference $ export OPENSSL=/opt/local/bin/openssl $ basename ${OPENSSL} openssl $ echo ${OPENSSL##*/} openssl Since basename is in the POSIX specs , I don't a reason why it should be best practice. Any hint?
Asked by Matteo (10024 rep)
Oct 9, 2013, 04:07 PM
Last activity: Jan 26, 2020, 04:19 PM