if [ $# -lt 3 ] #少于3个参数,错误! then showUsage exit 1 else sed "${2}a ${3}" $1 > tmpfile;mv tmpfile $1 fi
1 2 3 4 5 6 7 8 9 10 11 12 13
[Dong@MICRONSKY test]$ more a line1 line2 line3 line4 [Dong@MICRONSKY test]$ ./insert a 3 "Test" [Dong@MICRONSKY test]$ more a line1 line2 line3 Test line4 [Dong@MICRONSKY test]$