On Tuesday 18 April 2006 00:34, [EMAIL PROTECTED] wrote:
> In a shellp script, let
>        STRING="a.txt b.txt c.txt"
> And I want to delete a sub-string from $STRING, for example
> b.txt, and then we got
>        $STRING is "a.txt c.txt"
>
> How to achieve it?
>From man bash:
${parameter:-word}
Use Default Values.  If parameter is unset or null, the expansion of word is 
substituted.  Otherwise, the value of parameter is substituted.

So for what you want just do:
STRING="a.txt b.txt c.txt"
${STRING:-b.txt}

There are tons of ways to manipulate "parameters" and you should reference the 
man page for more.  Look under "Parameter Expansion" for all the 
possibilities.
-- 
Zac Slade
[EMAIL PROTECTED]
ICQ:1415282 YM:krakrjak AIM:ttyp99

-- 
[email protected] mailing list

Reply via email to