具体如下所示:

[root@oracle ~]# sh 3.sh
=================
xxx_1_xxxx 55
------------
Task Name:[xxx_1_xxxx]
Task ID:[55]

=================
xxx_2_xxx 56
------------
Task Name:[xxx_2_xxx]
Task ID:[56]

[root@oracle ~]#
[root@oracle ~]# cat 3.sh
list_task=("xxx_1_xxxx 55" "xxx_2_xxx 56")

IFS=$'\n'
for item_task in ${list_task[@]}
do
   IFS=""

   echo "================="
   echo "${item_task}"
   echo "------------"

   # variable
   item_task_name=$(echo ${item_task} | awk '{print $1}')
   item_task_id=$(echo ${item_task} | awk '{print $2}')

   # display
   echo "Task Name:[${item_task_name}]"
   echo "Task ID:[${item_task_id}]"


   echo ""

   IFS=$'\n'

done

[root@oracle ~]#

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

隐藏
变装