if [ "$1" == "-s" ]; then
echo "Connecting to host.."
scp root@IP_ADDRESS:/private/var/mobile/Library/SMS/sms.db /private/var/mobile/Media/开发者_StackOverflow社区BackupSMS
echo " "
exit
fi
I need to ask user for a IP-address, that will then be placed where IP_ADDRESS
is above. I'm new to scripts, but I'm trying.
How would I do this?
Use the built in read
command
read IP_ADDRESS
or, if you want a nice prompt:
read -p "Enter ip address: " IP_ADDRESS
and then add a $
to the scp line:
scp root@$IP_ADDRESS:/...
^
精彩评论