basicsys@mars~/lec4>x="abc def gh" basicsys@mars~/lec4>echo "$x" abc def gh basicsys@mars~/lec4>echo $x abc def gh basicsys@mars~/lec4>y=$x basicsys@mars~/lec4>echo "$y" abc def gh basicsys@mars~/lec4>echo $y abc def gh basicsys@mars~/lec4>y=$(echo $x) basicsys@mars~/lec4>echo $y abc def gh basicsys@mars~/lec4>echo "$y" abc def gh basicsys@mars~/lec4>cat F1 ab cd ef 555 77777 ab 1111 333 666 999999 basicsys@mars~/lec4>cut -d" " -f1,3,4 F1 ab ef 555 ab 333 666 basicsys@mars~/lec4>cut -d" " --output-delimiter=rwq -f1,3,4 F1 abrwqefrwq555 abrwq333rwq666 basicsys@mars~/lec4>cat F1 ab cd ef 555 77777 ab 1111 333 666 999999 basicsys@mars~/lec4>cut -c1,3,4 F1 a c a 1 basicsys@mars~/lec4>cut -c2- F1 b cd ef 555 77777 b 1111 333 666 999999 basicsys@mars~/lec4>cat F1 ab cd ef 555 77777 ab 1111 333 666 999999 basicsys@mars~/lec4>wc F1 2 10 42 F1 basicsys@mars~/lec4>wc 1234 ab 2 2 8 basicsys@mars~/lec4>cat F1 ab cd ef 555 77777 ab 1111 333 666 999999 basicsys@mars~/lec4>cat F2 abcdef basicsys@mars~/lec4>wc F1 F2 2 10 42 F1 1 1 7 F2 3 11 49 total basicsys@mars~/lec4>wc F1 - F2 2 10 42 F1 12345 6789 2 2 11 - 1 1 7 F2 5 13 60 total basicsys@mars~/lec4>cut -c2,4,6 123456 abcdef 246 bdf basicsys@mars~/lec4>cut -c2,4,6 F1 - F2 bc b11 123456 246 bdf basicsys@mars~/lec4>echo "123456" >| F3 basicsys@mars~/lec4>cat F3 123456 basicsys@mars~/lec4>cut -c2,4,6 F1 - F2 < F3 bc b11 246 bdf basicsys@mars~/lec4>cat F1 ab cd ef 555 77777 ab 1111 333 666 999999 basicsys@mars~/lec4>wc -l F1 2 F1 basicsys@mars~/lec4>x=$(wc -l F1) basicsys@mars~/lec4>echo $x >| tmp basicsys@mars~/lec4>cut -d" " -f1 tmp 2 basicsys@mars~/lec4>wc -l 1234 5555 2 basicsys@mars~/lec4>wc -l < F1 2 basicsys@mars~/lec4>cat F1 10 40 1000 5 basicsys@mars~/lec4>sort -n F1 5 10 40 1000 basicsys@mars~/lec4>sort F1 10 1000 40 5 basicsys@mars~/lec4>sort a z b a b z basicsys@mars~/lec4>echo abcd >|tmp basicsys@mars~/lec4>cut -c2 < tmp b basicsys@mars~/lec4>echo abcd | cut -c2 b basicsys@mars~/lec4>wc -l F1 4 F1 basicsys@mars~/lec4>cat F1>|tmp basicsys@mars~/lec4>wc -l < tmp 4 basicsys@mars~/lec4>cat F1 | wc -l 4 basicsys@mars~/lec4>cat P1 #!/bin/bash sum=0 for x in $(seq 10) do sum=$[$sum+$x] done echo $sum basicsys@mars~/lec4>P1 55 basicsys@mars~/lec4>cat P2 #!/bin/bash sum=0 for x in 10 20 30 do sum=$[$sum+$x] done echo $sum basicsys@mars~/lec4>P2 60 basicsys@mars~/lec4>cat P3 #!/bin/bash sum=0 for x in "ab cd" "efff gh" 1234 do echo "$x" done basicsys@mars~/lec4>P3 ab cd efff gh 1234 basicsys@mars~/lec4>cat P4 #!/bin/bash sum=0 for x in $* do sum=$[$sum+$x] done echo $sum basicsys@mars~/lec4>P4 10 20 30 60 basicsys@mars~/lec4>cat P5 #!/bin/bash echo "the first parameter is $1" echo "the second parameter is $2" echo "the number of parameters $#" echo "all the parameters are: $*" echo "all the parameters are: $@" basicsys@mars~/lec4>P5 10 20 30 40 AB the first parameter is 10 the second parameter is 20 the number of parameters 5 all the parameters are: 10 20 30 40 AB all the parameters are: 10 20 30 40 AB basicsys@mars~/lec4>cat P6 #!/bin/bash x=0 while [ $x -lt 5 ] do echo $x x=$[$x+1] done echo I finished the program basicsys@mars~/lec4>P6 0 1 2 3 4 I finished the program basicsys@mars~/lec4>cat P7 #!/bin/bash while read x do if [ $x -gt 5 ] then if [ $x -le 20 ] then echo $x fi fi done echo I finished the program basicsys@mars~/lec4>P7 3 6 6 20 20 21 I finished the program basicsys@mars~/lec4>cat F1 10 40 3 6 basicsys@mars~/lec4>cat P8 #!/bin/bash while read x do if [ $x -gt 5 ] then if [ $x -le 20 ] then echo $x fi fi doneP8 10 6 I finished the program