Answer the question
In order to leave comments, you need to log in
Why doesn't the function read the parameter?
Good everyone!
With the terminal is still on you, so I can not figure it out.
There is a function that should take the server number from the loop:
function func() {
ssh [email protected]$1.ru ....
}
for server in {01..03}
do
func $server
done
Answer the question
In order to leave comments, you need to log in
Everything should work.
Maybe you are not working in bash, but in some other shell?
$ cat a.sh
#!/bin/bash
function func() {
echo ssh [email protected]$1.ru ....
}
for server in {01..03}
do
func $server
done
$ ./a.sh
ssh [email protected] ....
ssh [email protected] ....
ssh [email protected] ....
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question