From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Neil Holmes" Subject: ash and String Manipulation Date: Fri, 3 Jan 2003 21:24:29 -0000 Sender: linux-8086-owner@vger.kernel.org Message-ID: Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: List-Id: Content-Type: text/plain; charset="us-ascii" 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