i have the following bash script contains multiple functions

```
#!/usr/bin/bash

#checks if the arguments is directory and extract the domain name from it
if [[ -d "$1" ]]; then
    domain=$(echo "$1" | grep -iEo '[[:alnum:]-]+\.[a-z]+')
    WORKING_DIR="$1"
else
    domain="$1"
    echo "it is domain name"
fi

example_fun1(){
    ping -c 4 $domain
}

example_fun2(){
    nslookup $domain
}

for x in "$@" ;do
    example_fun1 $x
    example_fun2 $x
done

```

and run as following

```
./script.sh ./pathtofolder/example.com/ ./pathtofolder/test.com/

```

Or

```
./script.sh example.com test.com

```

and working probably BUT i need to add more feature which is check if certain word based in arguments like `fun1` it will execute function example\_fun1 only

desired execution

```
./script.sh fun1 ./pathtofolder/example.com/ ./pathtofolder/test.com/

```

OR

```
./script.sh fun1 example.com test.com

```

Thanks