[Gllug] More on that bash script

Russell Howe rhowe at siksai.co.uk
Sat Apr 9 16:12:15 UTC 2005


On Sat, Apr 09, 2005 at 04:21:57PM +0100, Dylan wrote:
> Hi All,
> 
> having used ogginfo to extract the tags from a file to use for renaming 
> purposes, I find some of the tags contain the "/" character...
> 
> I've tried all sorts of things, but can't seem to get it just right, so 
> please - how would I change it to a "-" for example?

In the same section of the bash man page, it talks about doing stuff
like the following:

${var/foo/bar} - gives the value of var, with the first occurance (if
any) of foo changed to bar.

${var//foo/bar} - as above, but replaces all occurances.

So I guess you want something like:

artist="${tag///-}"

Note that the quotes are critically important from a security
standpoint.

-- 
Russell Howe       | Why be just another cog in the machine,
rhowe at siksai.co.uk | when you can be the spanner in the works?
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list