read -p "enter " var
ord() {
printf '%d' "'$1"
}
for (( i=0 ; i<${#var} ; i++ ))
do
ord "${var:i:1}"
done
Basically I have to take inputs, convert the characters in the strings into ASCII values then times them by a number. Currently the code I have takes the inputs, iterates through the characters and prints the ASCII values. I'm aware this is because of printf but without the printf the code stops working. How do I get it to convert the characters into ASCII values then store it in a variable. I'm very new to bash so please keep it as simple as possible. Thank you