Answer the question
In order to leave comments, you need to log in
How to put a multiple path into a variable?
Hi all!
When writing a script, it became necessary to put several paths into one variable, i.e., for example:
var=/test/{fol1,fol2
,
fol3
}
fol2,fol3 in the /test/ folder path, and creates directory 1 directory named {fol1,fol2,fol3}.
Tried double quotes, single quotes and backticks. Nothing helps. However, if you execute directly, then everything works.
mkdir /test/{fol1,fol2,fol3}.
What am I doing wrong?
Answer the question
In order to leave comments, you need to log in
So fit?
#!/bin/bash
var=(/test/{fol1,fol2,fol3})
mkdir -p "${var[@]}"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question