[NTLUG:Discuss] What scripting change do I need to make?

Christopher Cox cjcox at acm.org
Tue Oct 6 00:38:42 CDT 2015


On 10/05/2015 11:07 PM, Patrick R. Michaud wrote:
>
> On Mon, Oct 05, 2015 at 09:46:08PM -0500, Leroy Tennison wrote:
>> If only there was a way to tell mkdir "this isn't a string!".
>
> It's important to note that mkdir(1) itself never sees quotes, braces,
> or anything like that -- all of these expansions and substitutions
> are handled by the shell *before* the mkdir command is ever called.
>
> So, according to the bash(1) man page ("EXPANSIONS"):
>
>     The order of expansions is: brace expansion; tilde expansion, parameter
>     and  variable expansion, arithmetic expansion, and command substitution
>     (done in a left-to-right fashion); word splitting; and pathname
>     expansion.
>
> Thus, in the case of
>
>       mkdir -p test/{`seq -s, 1 3`}

eval is your friend

eval mkdir -p test/{$(seq -s, 1 3)}




More information about the Discuss mailing list