Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!bin/bash
- bashname=$0
- basharguments=$#
- args=("$@")
- number=2
- countEven=0
- sum=0
- filename=$1
- if test "$#" -eq 1
- then
- echo "Usage:bash $bashname"
- exit
- fi
- while test $number -ne $basharguments
- do
- if(( ${args[number]} % 2 == 0 ))
- then
- countEven=`expr $countEven + 1`
- fi
- number=`expr $number + 1`
- done
- echo "$countEven"
- shift
- for arg
- do
- sum=`expr $sum + $arg`
- done
- echo "$sum"
- d=`echo $sum | wc -L`
- echo "$d"
- if test -f "$filename"
- then
- echo $sum > $filename
- echo $d >> $filename
- elif test -h "$filename"
- then
- echo "File is symbolic"
- else
- echo "Error message"
- fi
- command=`cat $filename`
- echo "What is in the file:"
- echo "$command"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement