When running this script:
#!/bin/sh -ex
if [[ $# -ne 1 ]]; then
echo "./import-public-ssh-key.sh <absolute path to public key>"
exit 1;
fi
PATH=$1
KEY=$(basename ${PATH})
I get:
./import-public-ssh-key.sh: line 9: basename: command not found
without the subshell basename
works:
$ basename /Users/mles/.ssh/id_rsa.pub
id_rsa.pub
Why is basename
not working in the subshell? I'm on a mac if this is relevant.