×
Create a new article
Write your page title here:
We currently have 3,189 articles on s23. Type your article name above or create one of the articles listed here!



    s23
    3,189Articles
    Revision as of 20:44, 1 April 2008 by imported>mutante (New page: <pre> #!/bin/bash # Convert string to ASCII code # mutante / s23.org declare -a INPUT echo "Enter characters seperated by space to be converted to ASCII code. " read -a INPUT char_count=${...)
    (diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
    #!/bin/bash
    # Convert string to ASCII code
    # mutante / s23.org
    declare -a INPUT
    echo "Enter characters seperated by space to be converted to ASCII code. "
    read -a INPUT
    char_count=${#INPUT[*]}
    # echo $char_count
    i=0
    while [ $i -lt $char_count ]; do
    ASCII=`perl -e 'print ord shift' ${INPUT[$i]}`
    CHAR=${INPUT[$i]}
    echo -e "$CHAR - $ASCII"
    i=$(($i+1))
    done
    

    Can you change this so that input does not have to be seperated by spaces anymore?

    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.