Craig White wrote:
> On Mon, 2005-02-28 at 20:30 -0700, Kevin wrote:
>
>>On Mon, 2005-02-28 at 20:05 -0700, Craig White wrote:
>>
>>> if ${i:6:5} = "START"
>>> then printf $i >> $outfile
>>> else
>>> printf "if (!function_exists('_prefs_hook_$i')) { \n\n" >>
>>>$outfile
>>>
>>> fi
>>
>>
>>Maybe something like this?
>> if `echo $i | awk '{print substr($i,6,5)}'` = "START"
>>
>>I have not tried it. I'm just guessing. :) But seriously, the
>>substring function of awk (substr) jumped to mind. You might be able to
>>leverage it. I don't have my bash book handy, but there is probably a
>>more elegant way to handle this directly in bash.
>
> ----
> that may be a very good conditional...
>
> but the problem I am having is still the part...
>
> do if `echo $i | awk '{print substr($i,6,5)}'` = "START"
>
> which actually tries to execute the results of the substring function,
> much like my previous example with the substring function I was trying
> to do directly in bash.
>
> there is sort of black art thing to shell scripting that I didn't learn
> and my bash book doesn't impart upon me.
if [ conditions ]
then
fi
A few things to note, spaces are between the brackets and the conditions so:
if [ conditions ]
will work, but:
if [conditions]
will not work.
Second, = is the assignment variable, == is the test conditional
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss