So, I am trying to write a script to
1.) Create a new directory with the name the user has specified
2.) Download files from a remote location into the new directory
3.) Append a port to a file in the new directory
What I have now is
OPTIND=1
while getopts "hpnm:" opt; do
case "$opt" in
h)
show_help
exit 0
shift
;;
p) port="*@"
shift
/home/servers/zombies/"$server_name"/server.properties >> port: "$@"
;;
n) server_name="$*"
shift
mkdir /home/ecb/servers/zombies/"$*"
;;
m) map_name="$*"
shift
rsync -azvP username@host:/home/downloads/zombies/"$*" /home/servers/zombies/"$server_name"/
;;
esac
done
When I run the script it interprets "-n Test -m test -p 1234" as "Test test 1234". How would I separate the arguments?