Home » » Shell Scripting Tutorial For Beginners Eighteen - Until Loop

Shell Scripting Tutorial For Beginners Eighteen - Until Loop



#!/bin/bash # until loops n=1  # offset way echo "----until loops------first way-------------------" until [ $n -gt ten ] do     echo "$n"     (( n++ )) done   # instant way n=1 echo "----until loops------second way-------------------" until (( $n > ten ))   do     echo "$n"     (( ++n )) done  # 3rd way n=1 echo "----until loops------third way-------------------" until [ $n -gt ten ] do     echo "$n"     n=$(( n+1 )) done 
output


test@test: /Desktop$ ./hello.sh  ----until loops------first way------------------- 1 2 3 4 5 6 7 8 9 10 ----until loops------second way------------------- 1 2 3 4 5 6 7 8 9 10 ----until loops------third way------------------- 1 2 3 4 5 6 7 8 9 10 test@test: /Desktop$  

0 comments:

Post a Comment

Search

Blog Archive