View Single Post
Old 03-22-2012, 10:03 PM   #43
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773670
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Quote:
Originally Posted by kaminkatze View Post
echo ${v:1:1} returns -sh: syntax error: Bad substitution on my K3, and expr substr $v 1 1 is even slower than hexdump.
Hmm... I test most of my stuff on K4 and Touch. Only recently have I started trying scripting stuff on the K3 (due to the interest in this thread). I just now tested the ${a:b:c} type substrings on the K3, and the fail as you showed. I just tested again and they work on the Touch. If I want to support K3, I will have to use some more primitive constructs for the K3, instead of things like substring processing.

At least dd and hexdump work on everything...

I guess to be cross-platform, we need to find something that works on all of them. But for speed on newer kindles we also need newer things. Maybe we just need different scripts for different kindles...

For the K3, I guess it's back to $(echo $a|cut -b...)...

Calling commands that are built into busybox is not as time-consuming as one would think, because while running in /bin/sh, busybox is already memory-resident along with all its built-in commands. Other busybox commands may well be faster than advanced shell features partially or completely missing from the stripped-down busybox shell.

Last edited by geekmaster; 03-22-2012 at 10:52 PM.
geekmaster is offline   Reply With Quote