0
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

  • 2
    Does [this](https://stackoverflow.com/questions/70130059/how-do-you-convert-characters-to-ascii-without-use-of-the-printf-in-bash/70130129#70130129) answer to your question? – M. Nejat Aydin Dec 03 '21 at 15:34

0 Answers0