The brace-expansion tag has no wiki summary.
1
vote
1answer
62 views
Quoting curly braces in the shell [duplicate]
I found examples of different quoting for curly braces for find, but I could not find an explanation. The possible choices are:
1. {}
2. '{}'
3. "{}"
And they all seem to work fine. Is ...
2
votes
2answers
61 views
Expand less-than sign when using multios and brace expand
With zsh multios set (setopt multios) it's possible to do things like:
< in1 < in2 > out
and:
< in > out1 > out2
which is very convenient.
I want to combine this feature with ...
2
votes
2answers
159 views
How could I make multiple symbolic links for multiple directories, conveniently
lrwxrwxrwx 1 deploy users 20 1월 23 18:15 v122 -> /home/files/video122
lrwxrwxrwx 1 deploy users 20 1월 23 18:15 v123 -> /home/files/video123
lrwxrwxrwx 1 deploy users 20 1월 23 ...
1
vote
3answers
238 views
How to create a sequence with leading zeroes using brace expansion
When I use the following, I get a result as expected:
$ echo {8..10}
8 9 10
How can I use this brace expansion in an easy way, to get the following output?
$ echo {8..10}
08 09 10
I now that ...
3
votes
1answer
242 views
mkdir multiple directories with a subdirectory name having space in it
I want to make multiple directories in one go. The problem is that one of the sub directories have a name with a space in it. The directory structure i want to make is as follows.
project
/level ...
5
votes
2answers
131 views
Why arguments in braces do not expand in this case?
For example, I want to put some file names inside braces for expansion like this:
$ ls
blue_texture blue_waves green_light
$ ls -m | tr -d ' \n'
blue_texture,blue_waves,green_light
$ echo ...
1
vote
2answers
244 views
Auto-expansion problem with array elements containing an '*' (asterisk)
I'm trying to write me a find script that should later be able to read a list of directories to be excluded from an external file. Whilst I can accomplish that part myself, it's the annoying array ...
2
votes
1answer
107 views
Change completion behaviour with brace expansion in zsh
I have got used to using tab-autocompleting inside braces without expanding in zsh. This was possible, while I used zsh with a basic grml-config. Since I migrated to oh-my-zsh, I can't reproduce this ...
3
votes
2answers
426 views
Short way to scp using the same dir/file in origin and target
I am frequently updating files from a development enviroment to a production one in different servers so the paths are the same in both hosts and it becomes kind of a repetitive procedure to update a ...
7
votes
3answers
2k views
bash: Use a variable to store stderr|stdout redirection
Is there any way to redirect stdout and stderr via variable like adding command options in script?
For example I have a script:
#!/bin/bash -x
TEST=">/dev/null 2>&1"
OPT='-p -v'
mkdir $OPT ...
1
vote
3answers
277 views
Accessing bash [internal] brace expansion iteration number/variable
Question:
Is it possible to access which number of a bash iteration is currently being processed?
Psuedo-Command
mv {1..5}.something.{1..5} $x1.$x2.something
Note: This is a logical ...
1
vote
2answers
157 views
brace expansion other commands besides mkdir?
Found this nifty lifehacking gem to create multiple directories: http://unix.stackexchange.com/a/640/7768
I was wondering if there are other commands support brace expansion?
6
votes
2answers
659 views
Using curly brackets (braces) to create folder structure with `mkdir -p`
As man mkdir states
-p, --parents
no error if existing, make parent directories as needed
When I ran this command
mkdir -p work/{F1,F2,F3}/{temp1,temp2}
It creates a folder ...
2
votes
1answer
108 views
How can I control bash's brace expansion to do the right thing (which zsh does automatically)?
In zsh, I get the expected result from both of these brace expansions:
$ touch file-{001..100}
$ touch file-{1..100}
The first one gives me files named file-001, file-002, etc., all the way to ...
6
votes
2answers
239 views
How can I use $var in a shell brace expansion of a sequence?
I want to use $var in a shell brace expansion with a range, in bash.
Simply putting {$var1..$var2} doesn't work, so I went "lateral"...
The following works, but it's a bit kludgey.
# remove the ...