ls $usridir/$line | while read file do if [[ $file==access.log.* ]] then echo $file "hahahah" fi done [hadoop@mini2 study]$ ./t.sh access.log.1 hahahahtest1.sh hahahaht.sh hahahah 这个结果就不对,因为[[]]中的等号两端没有空格!,加上空格就对了 还有if后面必须有空格,then要和if在同一行then前面必
Write a program to remove all trailing blanks and tabs from each line of input, and to delete entirely blank lines. 其实做这道题目有两种思路: 1.后向模式:利用getline()先将输入流中,每一行完全接收,然后从接收的line字符串中末尾,往前扫,直到发现第一个非空格和制表符字符: 2.前向模式:每接收一个字符,都要进行输出.判断. /* K&R2 1-18 p31: Writ