View Single Post
Old 03-28-2012, 05:04 PM   #25
jmseight
Zealot
jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'
 
Posts: 130
Karma: 10000
Join Date: Mar 2012
Device: Kindle 3G, Kindle Touch 3G, iRiver Story HD, Sony Reader
Hi geekmaster,

Thank you for the hints. I am totally new at shell programming so am learning quite a bit from this. Thank you.

Does "${ST%?}" work on the K3? A lot of other similar string processing that works on newer kindles does not work on the K3.

>>>Yes. It works well.

[[ $K -eq 14 ]]&& ST="$(echo ${ST%?})" && continue # del

For example, where I used ${ST:$K:1} on newer kindles I had to change to the older "echo|cut" for the K3 in this script. I will test the "%?" thing you did later when I get time...

[[ $K -le 52 ]]&& L="$(echo \"$KM\"|cut -b$K-$K)"

Question: Why are you using Aa for Enter?

# [[ $K -eq 28 ]]&& break # enter
[[ $K -eq 190 ]]&& break # use Aa for enter

>>> If I used enter, then the Kindle home screen actually does a search of what I typed, and sometimes an annoying dialog box comes up. I find that Aa is more graceful.

The spacebar (keycode 57) worked for me:

[[ $K -eq 57 ]]&& L=" " # space

I think that this is eating your space:

ST="$(echo $ST$L)"

When passing parameters that may contain spaces, you should wrap them in quotes like this:

ST="$(echo \"$ST$L\")"

In this case, the escaped quotes become part of the echo command, and they protect any trailing space that is contained in the expansion of $L.

However in this particular case, why bother with an external command? Just do this instead:

ST="$ST$L"

>>> Got it. I did not know you can do this.

Best Regards,
James
jmseight is offline   Reply With Quote