I am trying to create a script that checks for two parameters. So far this is the code I have:
#!/bin/bash
portFile=$1
file=$2
if [ -z “$portFile” ] || [ -z “$file” ]
then
echo “Não tem parâmetros suficientes”
else
The user input should be something like this:
portscanner.sh -n 80 -h hostfile.txt
portscanner.sh -f portfile.txt -h hostfile.txt
My questions is how can I make sure that the first parameter is either -f or -n and make sure that the second one is -h with the file? thank you.