toolkit/func/core/pkg_which/10-test-which.sh

10 lines
344 B
Bash
Raw Permalink Normal View History

2021-07-05 06:50:25 +00:00
#!/bin/bash
r_log "which" "Testing that which can find bash"
/usr/bin/which bash | grep -Eq '^(/usr)?/bin/bash$'
r_checkExitStatus $?
r_log "which" "Testing that which fails on a command that doesn't exist"
/usr/bin/which obsidiaN 2> /dev/null
[ $? -eq 1 ] || { r_log "which" "Which should have failed." ; exit "$FAIL"; }
r_checkExitStatus $?