Tuesday, January 1, 2013

UNTIL loop example in Shell Script

LIMIT=10
var=0
until (( var > LIMIT ))
do  # ^^ ^     ^     ^^   No brackets, no $ prefixing variables.
  echo -n "$var "
  (( var++ )) ## increment operator in shell script
done    # 0 1 2 3 4 5 6 7 8 9 10
echo
exit 0

OUTPUT :

-bash-3.2$ sh until_sh
0 1 2 3 4 5 6 7 8 9 10
-bash-3.2$

No comments:

Post a Comment

Customer Credit Card Query

 select hca.cust_account_id,        hca.party_id,        hcas.party_site_id,        site_use_id,        hcsu.org_id,        hca.account_numb...