#!/bin/bash # Skript suma n=$1 i=1 sum=0 while [ $i -le $n ]; do sum=$((sum + $i)) i=$((i + 1)) done echo 'Soucet je '$sum
#!/bin/bash # Skript mdir for i in *; do echo $i done
#!/bin/bash # Skript msdir for i in *; do if [ -d "$i" ]; then echo 'Directory ' $i cd $i msdir echo 'End of Directory ' $i cd .. else echo $i fi done
#!/bin/bash # Skript mndir - number of files in dir num=`mmdir | wc -l` echo 'Directory ' `pwd` ' has ' $num ' files' for i in *; do if [ -d "$i" ]; then cd $i mndir cd .. fi done
#!/bin/bash # Skript mtree - dir tree if [ $# == 0 ]; then ind=0 else ind=$1 fi str='' j=0 while [ $j -lt $ind ]; do # echo $j str=\ $str j=$((j + 1)) done ind=$((ind + 1)) for i in *; do if [ -d "$i" ]; then echo "$str$i" cd "$i" mtree $ind cd .. fi done