#!/bin/bash
arr=('Debasish')
arg=""
length=${#arr[i]}
echo $length
#thing=($(i=0; while [ $i -lt ${#foo} ] ; do echo ${foo:$i:1} ; i=$((i+1)) ; done))
for (( i=0; i<$length; i++ ))
do
echo ${arr:$i:1}
a1="${arr:$i:1}"
A1=$(printf '%d\n' "'$a1")
echo $A1
arg="$arg $A1"
done
echo ""
echo $arg
echo ""
brr=($arg)
brg=""
brr_length=${#brr[@]}
for (( i=0; i<brr_length; i++ ))
do
echo ${brr[$i]}
declare -i j=${brr[$i]}
k=$(printf \\$(printf '%03o' $j))
echo $k
brg="$brg$k"
done`enter code here`
echo $brg
In the above code i have used an array to input a string and convert it into ASCII decimal values and its reverse.I want to know in place of a string how can i take a file as an input to the array and the process gets executed for the whole of the file.