Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #============= for3.sh ==================
- #!/bin/sh
- #metodo veloce: echo $*
- for par
- do
- echo $par
- done
- #============= es29.sh ==================
- #!/bin/sh
- if test $# -ne 1
- then echo Inserire un argomento; exit 1;
- fi
- if test ! -d $1
- then echo Inserire una directory; exit 2;
- fi
- cd $1
- count1=0
- count2=0
- for str in *
- do
- if test -f $str
- then
- echo F $str
- count1=`expr $count1 + 1`
- fi
- if test -d $str
- then
- echo D $str
- count2=`expr $count2 + 1`
- fi
- done
- echo File trovate: $count1
- echo Dir trovate: $count2
- #=========== es28.sh ===================
- #!/bin/sh
- for file in *
- do
- if test -f $file
- then
- grep '#!/bin/sh' $file > /dev/null
- if test $? -eq 0
- then
- echo $file
- fi
- fi
- done
- #=========== es27.sh ====================
- #!/bin/sh
- for str in *
- do
- if test -f $str
- then
- case $str in
- *.sh) echo $str >&2;;
- esac
- fi
- done
- #=========== es26.sh ====================
- !/bin/sh
- if test $# -ne 1
- then
- echo inserire un solo parametro;
- exit 1;
- fi
- case $1 in
- /*) echo nome assoluto;;
- */*)echo nome relativo;;
- *) echo nome relativo semplice;;
- esac
- #============ es25.sh ===================
- #!/bin/sh
- count=0
- ultimo=
- args=
- for par
- do
- count=`expr $count + 1`
- if test $count -eq $#
- then
- ultimo=$par
- else
- args="$args $par"
- fi
- done
- echo "Ultimo parametro: $ultimo"
- echo "Parametri: $args"
- #============ APPEND.SH ================
- #!/bin/sh
- case $# in
- 1)cat >> $1;;
- 2)cat < $1 >> $2;;
- *)echo Inserire 1 o 2 parametri;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement