Re: bash scripts conditionals and substrings

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Craig White
Date:  
To: plug-discuss
Subject: Re: bash scripts conditionals and substrings
On Mon, 2005-02-28 at 22:35 -0700, Kevin wrote:
> On Mon, 2005-02-28 at 22:08 -0700, Craig White wrote:
> > ./pref_prefs_hooks.create: line 10: [: =: unary operator expected
>
> Did you try == instead of = ?
>
> As Kevin Brown mentioned "= is the assignment variable, == is the test
> conditional"

----
yea - I'm sorry - I should have checked that before I have posted it...

I now have in my tried and failed...

#    if [ "START" == ${i:5:5} ]
#    if [ `echo $i | awk '{print substr($i,5,5)}'` = "START" ]
#    if [ `expr substr $i 5 5` == "START" ]


this is exasperating

Craig

awk is light years slower

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss