I declared variable (string) containing k names of queues, I want to delete.
How can i "loop" through the string and delete each queue?
I'm having trouble with the awk command.
thanks a lot!
你可以试试下面的命令吗?
awk '{for(i=1;i<=NF;i++) {printf "%s ", $i}; printf "\n"}' | xargs rm
there are many ways, I think the simplest will be
$ vars="name1 name2 name3"
$ for v in $vars; do echo $v; done
name1
name2
name3
change echo to your script.
You can use xargs
:
queues="q1 q2 q3 q4"
echo ${queues} | xargs -n1 echo "Remove"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.