1. #!/bin/bash echo $# 2. #!/bin/bash echo $1 echo $2 echo $3 echo $* 3. #!/bin/bash if test $# -ne 2; then echo nie dwa else echo dwa fi 4. #!/bin/bash if test $# -gt 2; then echo za duzo args else if [ $1 == $2 ]; then echo argumenty takie same; else echo argumenty inne; fi fi 5. #!/bin/bash if [ $1 == $2 ]; then echo argumenty takie same; elif [ $1 == 0 ]; then echo pierwszy == 0; else echo inne arg lub 1 != 0 fi #!/bin/bash if test $1 == $2 -o $1 == 0; then echo pierwszy == 0 lub takie same; else echo inne arg lub 1 != 0 fi 6. #!/bin/bash if test -d $1; then ls -l $1; else echo $1 to nie katalog fi 7. #!/bin/bash if test -f $1; then wc -c $1; else echo $1 to nie plik fi 8. #!/bin/bash for x in $* do echo $x; done 9. #!/bin/bash for x in $* do if test -f $x;then cp $x ${x}bak fi done 10 #!/bin/bash for x in $* do if test -f $x;then cat $x | tr -s [:blank:] > ${x}bak fi done 11. #!/bin/bash for j in `find -type f` do echo $j ma wielkość: `cat $j |wc -c `; done 12. #!/bin/bash if test $# -eq 1;then for j in `find -type f -name "$1*"` do echo $j ma wielkość: `cat $j |wc -c `; done else echo nie podano argumentu fi 13. #!/bin/bash if test $# -ne 1; then echo nie podano argumentu elif test -d $1; then for j in `ls $1` do if test -f $j;then echo $j ma wielkość: `cat $j |wc -c `; fi done else echo nie jest katalogiem fi 14. #!/bin/bash if test -d BACKUP; then echo jest juz katalog... exit else mkdir BACKUP fi if test $# -eq 1;then for j in `find -type f -name "$1*"` do cp $j BACKUP/$j done else echo nie podano argumentu fi