Let me explain this script. The script will take input from user in to VAL1 variable and pass it to printf command. printf "%o" $VAL1 will try to change the decimal value to octal. then this octal value is once again feed to the second printf as printf "\octvalue\n". printf command have one option what ever followed after \ will be treated as octal which helps use to convert to ascii values.
Want to print all the ascii values?
Execute below script to do that
#!/bin/bash for i in {32..127}doprintf "\\$(printf "%o" $i)\n"done

or just one single liner which will work in bash version 4 and above.
printf "$(printf "\%o\n" {32..127})"
Please comment your thoughts on this.