Skip to content

Instantly share code, notes, and snippets.

@plank-sr
Last active March 15, 2016 01:47
Show Gist options
  • Save plank-sr/5cdc39f3397c10690901 to your computer and use it in GitHub Desktop.
Save plank-sr/5cdc39f3397c10690901 to your computer and use it in GitHub Desktop.
create a string starting with 1 and concat n+1, until you reach the charcter length you want, in this case 32
#!/bin/sh
# reset num to zero unset iteration if you want to run it over again.
num=0; unset iteration; while [[ $num -lt 32 ]] # continue to increase iteration until $num is 32
do
let num=$((1+$num)) # increase num by 1
let modu=$((num%10)) # get digits between 0 and 9
iteration="${iteration}${modu}" # concat previous iteration with modu
printf "%s\n" "${iteration}" # print iteration as a string so you can go past 20 decimal limit,
done # you can use echo instead of printf if you want
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment