If you want to have basename and dirname a little faster through shell builtins, you may want to try these in bash or Korn Shell:
- basename: ${file##*/}
- dirname: ${file%/*}
I don’t really recommend to use these substitutes, I still find basename and dirname quite readable and I am not using them in a loop anyway.
Leave a Reply