Pal's Web Log
Programming - Linux, Ubuntu, Python, Django, Postgres, HTML, Cloud, Data Science etc.
Labels
Django
Docker
Google Cloud
Linux
Postgres
Python
Monday, July 6, 2015
Range or Sequence in Shell Script
Following is an example to print numbers 1 to 20 in a shell script. The numbers below 10 need to be printed with 2 digits like 01..09
#!/bin/bash
for i in $(seq 20)
do
if [ $i -le 9 ]
then echo 0$i
else echo $i
fi
done
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment