brace-expansion Questions
4
Solved
When writing a Bash script you can use brace expansion to quickly generate lists:
What is the simplest way to generate a similar list in Powershell? I can use the .. or , operators to generate a...
Groundless asked 25/4, 2013 at 18:50
3
Solved
I'd like to generate all permutations of letters up to length n
For example, for the argument 2 I'd like obtain a list like
a
aa
..
az
...
z
za
..
zz
I tried using a for loop to generate n increa...
Tiaratibbetts asked 6/3, 2023 at 15:3
3
Solved
Given this very simple Makefile:
all:
@mkdir -pv test/{a,b}
I get this output on OS X 10.6.8 and CentOS 5.5:
mkdir: created directory `test'
mkdir: created directory `test/a'
mkdir: created di...
Integument asked 13/7, 2011 at 15:42
2
Solved
I'm running the following RUN command in my Dockerfile, expecting a "logs" directory to be created under each of the listed subdirectories:
RUN mkdir -p /opt/seagull/{diameter-env,h248-env,http-en...
Ministrant asked 20/10, 2016 at 21:13
4
Solved
I am working on a very simple bash script and I'm having a problem with understating why deprecated $[] is working flawlessly, while $(()) seems to break the whole thing.
The code I'm referring to...
Dennet asked 14/10, 2016 at 1:19
2
I just wanted to know what is the difference between:
echo {$number1..$number2}
AND
eval echo {$number1..$number2}
Of course, imagine that there is a value in $number1 and $number2.
With the fi...
Benedictus asked 3/2, 2019 at 0:7
2
Solved
I saw the following code in Bash shell Decimal to Binary conversion and I was wondering how it works? I tried googling with no avail.
D2B=({0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1})
echo $...
Cloudberry asked 24/6, 2017 at 16:24
2
Solved
I have four files:
1.txt 2.txt 3.txt 4.txt
in linux shell, I could use :
ls {1..4}.txt to list all the four files
but if I set two variables : var1=1 and var2=4, how to list the four files...
Tamarah asked 3/11, 2015 at 4:8
2
Solved
Bash allows me to write the statement,
$ for i in {h..k} ; do echo $i ; done
but zsh only allows number list expansion such as {8..13}.
What's the best workaround? Something like seq for charac...
Villainy asked 7/3, 2010 at 1:5
5
Solved
Here is myscript.sh
#!/bin/bash
for i in {1..$1};
do
echo $1 $i;
done
If I run myscript.sh 3 the output is
3 {1..3}
instead of
3 1
3 2
3 3
Clearly $3 contains the right value, so why does...
Mingmingche asked 28/3, 2012 at 15:41
3
Solved
When I needed to run a command multiple times with a different argument I used this approach (without understanding it fully):
touch {a,b,c}
Which is equivalent of:
touch a
touch b
touch c
I ...
Goring asked 20/12, 2012 at 12:3
1
Solved
In bash, I can do the following
$ echo bunny{1..6}
bunny1 bunny2 bunny3 bunny4 bunny5 bunny6
Is there a way to achieve the same result in fish?
Danged asked 25/12, 2013 at 8:43
4
Solved
When using a POSIX shell, the following
touch {quick,man,strong}ly
expands to
touch quickly manly strongly
Which will touch the files quickly, manly, and strongly, but is it possible to dynam...
Teddi asked 11/5, 2009 at 4:44
9
Solved
I want to do something like this in a bash script. I'm using bash 4.1.10.
# rm -rf /some/path/{folder1,folder2,folder3}
Works nicely (and as expected) from the shell itself. It deletes the 3 des...
Dresden asked 1/7, 2011 at 14:6
5
Solved
WEEKS_TO_SAVE=4
mkdir -p weekly.{0..$WEEKS_TO_SAVE}
gives me a folder called weekly.{0..4}
Is there a secret to curly brace expansion while creating folders I'm missing?
Epiphenomenalism asked 18/2, 2012 at 0:56
4
Solved
I understood what brace expansion is.
But I don't know where I use that.
When do you use it?
Please give me some convenient examples.
Thanks.
Holofernes asked 25/9, 2010 at 9:4
1
© 2022 - 2024 — McMap. All rights reserved.