linux shell 读取for循环中出现难处理的数据之单引号错误实例

原语句:

#!/bin/bash

for test in I don't know if this'll work

do

echo "work:$test"

done

结果:

work:I

work:dont know if thisll

work:work

改成后语句:

#!/bin/bash

for test in I don\'t know if "this'll" work

do

echo "work:$test"

done

结果:

work:I

work:don't

work:know

work:if

work:this'll

work:work

上一篇:centOS下更新yum源


下一篇:UICollectionView(集合视图)以及自定义集合视图