[GTALUG] Bash Problem

Chris F.A. Johnson chris at cfajohnson.com
Mon Jan 9 17:47:50 EST 2017


On Sun, 8 Jan 2017, Mauro Souza via talk wrote:

> Or
> nFname="${base}.mp4"
> 
> Using brackets you can mix variables and text and create something like this:
> newName="${oldname}-bkp-${filedate}.${extension}.old"

The braces are not necessary here. This will work fine:

newName="$oldname-bkp-$filedate.$extension.old"

Braces would be necessary if you were using underscores instead of
hyphens because they can be part of a variable name:

newName="${oldname}_bkp_$filedate.$extension.old"

-- 
Chris F.A. Johnson, <http://cfajohnson.com>


More information about the talk mailing list