0

需要关于 shell 脚本的建议来读取文件并根据模式回显

 cat revs.txt
 1
 3
 8:13
 18:71
 89


  if x:x then echo "This is revs range"
   else 
  echo " this is single rev"
4

1 回答 1

2
while read rev
do
    case "$rev" in
    (*:*) echo "This is a range of revisions $rev";;
    (*)   echo "This is a single revision $rev";;
    esac
done < revs.txt
于 2013-06-17T23:10:30.933 回答