Linux shell编程——if条件判断 if [ condition ] ;then //一定要注意[] 與裡面的內容要有空格隔开 例如 if [(空格)${a} -eq 3(空格)]; then commandelif commandfishell脚本接收输入时,判断输入个数 用#计算if [ $# != 1 ] ; then echo "Usage: ./run.sh normal or quick" exitfi获取对应的输入值 用$nstyle=$1 比較,字符串变量表达…
shell sed 替换功能 f1 = open('yesterday','r',encoding='utf-8') f2 = open('yesterday2','w',encoding='utf-8') for line in f1: if '噢 昨日当我年少轻狂'in line: line = line.replace('噢 昨日当我年少轻狂','啦啦啦啦啦啦啦啦啦') f2.write(line) f1.close() f2.close() 要替换的文件: Somehow, it see…