Write a shell script to display first ten positive numbers using until loop.
1 2 3 4 5 |
num=1 until [ $num -gt 10 ]; do echo $num num='expr $num + 1' done |
Archive pages
1 2 3 4 5 |
num=1 until [ $num -gt 10 ]; do echo $num num='expr $num + 1' done |
echo “Enter Filename to check its permission” read i ls -l $i
echo ” Enter any number “read isum1=0sd=0while [ $i -gt 0 ]; do sd=$(( $i % 10 )) i=$(( $i / 10)) sum1=$(( sum1 + sd ))doneecho ” The summation of number is $sum1 “
echo -n “Enter soruce file name : “ read src echo -n “Enter target file name : “ read targ if [ ! -f $src ] then echo “File $src does not exists” exit 1 elif [ -f $targ ] then echo “File $targ exist, cannot overwrite” exit 2 fi # […]
Let the Employee file be (Employee.txt): 1 Tushar Coder 6-2-91 40000 2 Ankur Analyst 21-2-91 35000 3 Ravi Designer 23-4-90 37000 4 Bhupender Tester 7-6-91 41000 5 Sumit Coder 5-9-90 40000 6 Arnab Tester 12-8-90 30000 Type in the Terminal awk ‘{a+=$5}END{print a}’ Employee.txt
echo “First Odd and Even number till 30 are” n=1 while [ $n -lt 30 ]; do out=$(( $n % 2 )) if [ “$out” -eq 0 ] then echo “$n is even number” else echo “$n is ODD number” fi n=$(( $n + 1 )) done
echo “Enter the number”read nsd=0rev=0while [ $n -gt 0 ]; do sd=$(( $n % 10 )) rev=$(( $rev * 10 + $sd )) n=$(( $n / 10 ))doneecho “Reverse of entered digit is $rev”
echo ” Enter any number “read ntemp=$(($n-1))while [ $temp -gt 1 ]; do n=$((n * temp)) temp=$((temp – 1))doneecho “Factorial of number is $n”
Steps in building the Macros: 1. In Terminal enter vi tushar.txt 2. Type i followed by 1 3. Press [Esc] key (to enter into command mode) 4. Press q followed by a ( q indicates start recording ) ( a indicates to store the recording in register a ) 5. Press [Esc] then yy […]
Server2Go is a Webserver that runs out of the box without any installation and on write protected media. This means that you can use Server2Go to develop your Drupal site locally (or copy over a Drupal site you have already made) and then burn it to a CD. The CD version will be fully searchable […]
Recent Comments