logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git

basename.t (343B)


  1. #!/bin/sh
  2. failed=0
  3. path=../bin/basename
  4. status() {
  5. if [[ $2 -eq 0 ]]; then
  6. echo "OK: ${1}"
  7. else
  8. echo "FAILED: ${1}"
  9. failed=1
  10. fi
  11. }
  12. [[ "$(${path})" == "." ]] ; status "no args" $?
  13. [[ "$(${path} /usr/bin)" == "bin" ]] ; status "/usr/bin" $?
  14. [[ "$(${path} /usr/bin-test -test)" == "bin" ]] ; status "/usr/bin-test -test" $?
  15. exit $failed