From owner-freebsd-questions@FreeBSD.ORG Sat Apr 9 13:43:49 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C02D106566C for ; Sat, 9 Apr 2011 13:43:49 +0000 (UTC) (envelope-from dino_vliet@yahoo.com) Received: from nm20-vm0.bullet.mail.sp2.yahoo.com (nm20-vm0.bullet.mail.sp2.yahoo.com [98.139.91.218]) by mx1.freebsd.org (Postfix) with SMTP id 44D2D8FC12 for ; Sat, 9 Apr 2011 13:43:49 +0000 (UTC) Received: from [98.139.91.64] by nm20.bullet.mail.sp2.yahoo.com with NNFMP; 09 Apr 2011 13:31:29 -0000 Received: from [98.139.91.5] by tm4.bullet.mail.sp2.yahoo.com with NNFMP; 09 Apr 2011 13:31:29 -0000 Received: from [127.0.0.1] by omp1005.mail.sp2.yahoo.com with NNFMP; 09 Apr 2011 13:31:29 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 238519.78329.bm@omp1005.mail.sp2.yahoo.com Received: (qmail 51469 invoked by uid 60001); 9 Apr 2011 13:31:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1302355888; bh=fcUoVkjQeA8AjBIcARvHI4xwCBMDMGtI8mfKGymCytA=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=WtGavopr028ish78oDkNm4K13+yRGLAQu65XxjhnR5FXSUa1wnb8gqati13//uq2b/D5Zk1/p6WumU7hJE+rtwz+B7s2KDF8SWUT+WFbqUv51rOF0XNk3EZ7jUZDGfwy0mLPWgROEhYgaMgtf7HRrpyzPND6BT+2OZS6UiTId7I= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=2iaNh0gix5v05wbK5+W5vZGYzGLaGuZ4t6atVDlUSoIsr60I0+NLOMOt/2ZWsa3poY2Lr6MB6Qp+LrPcvXAWlxkAhht6AuittRK/saBeuE3+HTK60oiKGNvf6ncbjgO/ZyMvHfN8iI8K+VmTPpFfbZ+/gHtTkvaK5GC9ehBAVxI=; Message-ID: <824253.34690.qm@web113616.mail.gq1.yahoo.com> X-YMail-OSG: sgGnDTYVM1n0_.VgTBJYmO0CZh4Eh0G0TFJoXQHKStPCbgE FZaEBTFLiCRqTsSb9Y7jMS6l_TgvU6n3O4bYZSDn3ducnpnrySFz.nbkD_2O dCwXD63DzdnKHViaQD6aW5knlJZw7yt9T1Y5_cwx5jEWE7Qdd2Vnsu4GvxkV GYZa.yjX2XGz6F.8cUNQ_TC07WWary87Qe6ghsVTP7scJOu1lsAT092YRE4E Do8eXz220b.1Lwm2chX7tAMnKN1_TKftCddUJRUL3seVJHrgA_.wnDrULmYp 0MA1HDwEazXZpZ6k.vJCkVO4GhDqvGMzkHyaBNqR6xiZUoQVfGKdy4udXTtH wR2PiyefvU2dkN6Bq6Kn_3HMoKR1rT1PMAQOQnBCGYnJzJi4ztsbfH6mLoQB PB1QGbHMmXjN8 Received: from [212.64.31.247] by web113616.mail.gq1.yahoo.com via HTTP; Sat, 09 Apr 2011 06:31:28 PDT X-Mailer: YahooMailClassic/12.0.2 YahooMailWebService/0.8.109.295617 Date: Sat, 9 Apr 2011 06:31:28 -0700 (PDT) From: Dino Vliet To: freebsd-questions@freebsd.org MIME-Version: 1.0 X-Mailman-Approved-At: Sat, 09 Apr 2011 15:41:30 +0000 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: shell programming question: help with expr command X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2011 13:43:49 -0000 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= script? #! /usr/local/bin/bash # testscript=20 var1=3D"trees.J48" #other value will be rules.Jrip, rules.DecisionTable len=3D${#var1} 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? Thanks