I’ve my .sh script as
#!/bin/bash
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: sync.sh DIRECTORY_LOCATION"
exit 1
fi
DIRECTORY_LOCATION=$1
DEV_INSTANCE_IP=<some ip>
# Update data
scp -pR ${DEV_INSTANCE_IP}:${DIRECTORY_LOCATION}/* ${DIRECTORY_LOCATION}/
How do I run this script??
I tried sh sync.sh <path to directory> but it echos the line Usage: sync.sh DIRECTORY_LOCATION. Does that mean it’s being run??
yes it’s running,
-zflag meansIf either first argument or second is empty –> exit.
one way of getting more information is to change the shebang to
#!/bin/bash -xthis will tell bash to print every line that is executed including the value of the parameters.