public inbox for linux-8086@vger.kernel.org
 help / color / mirror / Atom feed
* ash and String Manipulation
@ 2003-01-03 21:24 Neil Holmes
  2003-01-04  9:50 ` jb1
  0 siblings, 1 reply; 10+ messages in thread
From: Neil Holmes @ 2003-01-03 21:24 UTC (permalink / raw)
  To: Linux 8086

Not sure if there is anyone out there in elks-land that can make some
suggestions here ?

As you know EDE has been developed using shell scripts. Ash is the shell
that we are working with. I had little experience of ash prior to this
exercise. I always understood ash to be a stripped down shell but have
generally found a way around any limitations that I hit. I am scratching my
head a little at the moment though on string manipulation and not being able
to find anything substantial on the web or in the news groups, I thought I
would post a question here. It may save me some time if somebody has some
experience.

Here is a segment of a test script from my EDE Package work :-

string="advent,Text Adventure Game,advent.tar"
a=`expr index "$string" ,`
title=${string:0:$a-1}
trimx=${string#$title}
trim1=${trimx#,}
a=`expr index "$trim1" ,`
desc=${trim1:0:$a-1}
trimx=${trim1#$desc}
tarfile=${trimx#,}
echo "${title}    ${desc}     ${tarfile}"

Run this with bash on Linux and the output is fine. The split up string from
line 1.

Run exactly the same script with ash (on Linux is fine) with and you get :-

strgcut: 3: Syntax error: Bad substitution

It would seem that, as a cut down shell, string manipulation is not a strong
point in ash. What I am struggling to find is a way to code around this. The
"expr index" command does work but I don't seem to be able to find enough
tools in ash to get me where I would like to be. I believe in some shells
there is an "expr substr" but not here.

Has anyone any ideas ?

Thanks

Neil






^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2003-01-09  9:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-03 21:24 ash and String Manipulation Neil Holmes
2003-01-04  9:50 ` jb1
2003-01-06 11:12   ` Neil Holmes
2003-01-07 11:04     ` jb1
2003-01-07 11:02       ` Neil Holmes
2003-01-07 12:42       ` Alan Cox
2003-01-07 12:12         ` Al Riddoch
2003-01-07 12:52           ` Paul Nasrat
2003-01-07 13:57             ` Al Riddoch
2003-01-09  9:37             ` sed-1.3 problems [WAS: Re: ash and String Manipulation] jb1

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox