I'm trying to run a script and seeing pushd: not found
#!/usr/sh
# stop script on error
set -e
# Check to see if root CA file exists, download if not
if [ ! -f ./root-CA.crt ]; then
printf "\nDownloading AWS IoT Root CA certificate from AWS...\n"
curl https://www.amazontrust.com/repository/AmazonRootCA1.pem > root-CA.crt
fi
# Check to see if AWS Device SDK for Python exists, download if not
if [ ! -d ./aws-iot-device-sdk-python ]; then
printf "\nCloning the AWS SDK...\n"
git clone https://github.com/aws/aws-iot-device-sdk-python.git
fi
# Check to see if AWS Device SDK for Python is already installed, install if not
if ! python -c "import AWSIoTPythonSDK" &> /dev/null; then
printf "\nInstalling AWS SDK...\n"
pushd aws-iot-device-sdk-python
pip install AWSIoTPythonSDK
result=$?
popd
if [ $result -ne 0 ]; then
printf "\nERROR: Failed to install SDK.\n"
exit $result
fi
fi
The script stops short with:
root@routeserve:~/connect_device_package# ./start.sh
Cloning the AWS SDK...
Cloning into 'aws-iot-device-sdk-python'...
remote: Enumerating objects: 879, done.
remote: Counting objects: 100% (143/143), done.
remote: Compressing objects: 100% (85/85), done.
remote: Total 879 (delta 73), reused 60 (delta 58), pack-reused 736
Receiving objects: 100% (879/879), 337.48 KiB | 2.64 MiB/s, done.
Resolving deltas: 100% (426/426), done.
Installing AWS SDK...
./start.sh: line 20: pushd: not found