while命令有點象if-then和for循環的結合。while測試命令返回0退出狀態,就循環一組命令。while基本格式:while test commanddoother commandslinux查找文件命令。done示例:#!/bin/bashvarl=5while?[?$varl?-gt?0?]dolinux退出命令,echo?$varlvarl
#!/bin/bash shell循環讀取文件?file="states" for state in `cat $file` do echo "Visit beautiful $state" done ? 轉載于:https://www.cnblogs.com/daochong/p/6107490.html