从变量读取列表

5年以前  |  阅读数:469 次  |  编程语言:Shell 
#!/bin/bash
# using a variable to hold the list

list="Alabama Alaska Arizona"
list=$list" Connecticut"

for state in $list
do
    echo "Have you ever visited $state"
done

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8