Find the answer to your Linux question:
Results 1 to 3 of 3
i am trying to represent alphabet into a array, and then i can count the frequency for example array[a]=0 array[b]=0 but i find the index of the array seems to ...
  1. #1
    Just Joined!
    Join Date
    Jun 2010
    Posts
    16

    bash arrays

    i am trying to represent alphabet into a array, and then i can count the frequency
    for example
    array[a]=0
    array[b]=0

    but i find the index of the array seems to be
    array[1]=0
    array[2]=0

    I was try this way get the ascii for them, actually I have done this in java and it is simple.
    something like this format
    array[ascii{a}-ascii{a}]=0
    array[ascii{b}-ascii{a}]=0
    I have done a lot of searching , but cannot get what I want.
    '%d\n' "'$char" like this would not work.

  2. #2
    Just Joined!
    Join Date
    Jun 2010
    Posts
    16
    for i in {a..z}
    do
    alphabet[$i]=0
    done

    actually I try to do this at the beginning.

  3. #3
    Just Joined!
    Join Date
    Jun 2010
    Posts
    16
    Up up up
    go HOLLAND

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...