0

I have this little script here:

#!/bin/bash

for i in {"$@"}
do

echo "fping -g $@"
done

fping command in used for scanning purposes. I want to feed it with multiple arguments but when I execute the script it passes all positional parameters at the same time.

fping -g 1 2 3 4
fping -g 1 2 3 4
fping -g 1 2 3 4
fping -g 1 2 3 4

My goal is to have it like this :

fping -g 1
fping -g 2
fping -g 3
fping -g 4

Could you help?

0

1 Answer 1

0

You just need to use the "i" variable to achieve what you want.

for i in "$@"
do
        echo "fping -g $i"
done

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.