授权
cd /Users/lion/Downloads/shell-test-demos
chmod u+x *.sh
#!/bin/bash
printHelp() {
echo "-p pic (required) path for pic"
exit 1
}
while getopts 'p:h' OPT; do
case $OPT in
p) path="$OPTARG" ;;
esac
done
# check api_key exists
if [ -z "$path" ]; then
echo "path is empty"
printHelp
fi
echo "path = $path"