Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Apr 2011 06:31:28 -0700 (PDT)
From:      Dino Vliet <>
Subject:   shell programming question: help with expr command
Message-ID:  <>

Next in thread | Raw E-Mail | Index | Archive | Help
Hi folks,
I'm having trouble with a little shell script. Can somebody explain me why =
I get 3 times "expr: syntax=A0 error" in my console after I run this little=

#! /usr/local/bin/bash
# testscript=20

var1=3D"trees.J48" #other value will be rules.Jrip, rules.DecisionTable
ind=3D`expr index $var1 s`
pos=3D`expr $len - $ind`
out=3D`expr substr $var1 $ind $pos`=20

I would expect (and want the following to happen):

$ind should contain 6
$pos should contain 3
$out should contain J48 (other values will have to be Jrip,DecisionTable)

Can anyone help me with this?


Want to link to this message? Use this URL: <>