MacOS – Bash script to run command with prompt for input

bashmacosscript

How can I create a script using the following command?

mmap -sn -n x.x.x.x/8, /16, /24 and so on. I would like the script to run the command when I type in "sweep" and then prompt me for the subnet that I would like it to look on.

Best Answer

In your script you can put :

echo "Input subnet"
read subnet 

to get user input and store it in a variable called subnet.

Obviously there is no check to see if you entered a valid subnet.