From: Lionel Thiry Date: 2004-10-14T00:40:23+09:00 Subject: [nuby] shell-like substitution in a string Hi! I'd like to make some kind of substitution like in a shell, i.e. having: "${tool} -o ${target} -L${libpath} -l${lib} ${source}" with an env like this: env = { "tool" => "gcc", "target" => "hello.exe", "libpath" => "/usr/lib", "lib" => "somelib", "source" => "hello.c" } it should give: "gcc -o hello.exe -L/usr/lib -lsomelib hello.c" It is easy until I want to manage caracter escapement like "${var\\}weird}" which should give env["var}weird"], "\\${var}" which should give the simple string "${var}" and "\\\\${var}" which should be equivalent to "\\" + env["var"]. Any idea of how I could manage that? Lionel Thiry