I'm trying to make this program work and I can't, The script i want must should calculate count of char use in string example : string=good result=g1o2d1 is there any way to write script that calculate exactly count of string like my example or not ?
 #!/bin/bash
    string=ssstttrrrriiiinnnnngg
    z=$( for((i=0;i<${#string};i++)) do; echo ${string:i:1}; done | uniq -c )
    echo $z
my result :
s 3 t 3 r 4 i 4 n 5 g 2
but for analysis some document i want script to calculate char some like firstchar1=$( bash script ) ...... i need that value for use another script please advise me regards
 
     
    