#!/bin/bash
# expm
# ab function to execute the output from input function one by one
ab () {
ping=$1
sleep 5s
ifconfig=$1
}
read -p "enter values: " Values
# input function to format input on a new line
input () {
echo " $(echo $values | awk '{print $1,$2}' FS='-' RS=' ' OFS='-') "
}
# the below line is to take the input function output and compute it to the ab function one by one
input
while IFS= read -r input; do
ab "$input"
done
У меня возникает проблема при запуске сценария
. / Expm w23r.ab c: eg-1/23-we34.ab c: eg-2/43 we4r.ab c: eg-2/25-w5wr.ab c: eg-1/63 wewr.ab c: eg-6 / 23-45wr.ab c: eg-3/24
он дает только следующие выходные данные
w23r.abc:eg-1/23
we4r.abc:eg-2/25
wewr.abc:eg-6/23
Моя желаемая цель - l oop вышеупомянутое значение через функцию ab по одному, независимо от того, сколько строк на выходе составляет
Скрипт после ShellCheck
#!/bin/bash
# expm
# ab function to execute the output from input function one by one
ab ()
{
ping=$1
sleep 5s
ifconfig=$1
}
read -r "enter values: " values
# input function to format input on a new line
input () {
echo " $(echo "$values" | awk '{print $1,$2}' FS='-' RS=' ' OFS='-') "
}
# the below line is to take the input function output and compute it to the ab function one by one
input
while IFS= read -r input;
do ab "$input"
done