Skip to main content

Questions tagged [brace-expansion]

A shell mechanism which is used to generate arbitrary strings.

0 votes
0 answers
38 views

I have a script which is supposed to fetch 2 URLs sequentially: #!/bin/bash wget_command='wget --restrict-file-names=unix https://www.example.com/{path1,path2}/' $($wget_command) echo $wget_command ...
MonkeyZeus's user avatar
1 vote
0 answers
37 views

Suppose I have the following directory structure: folder/ aaa/ f.txt bbb/ f.txt I want to compare the file f.txt as it is common to both directories. So in zsh I type this: % diff folder/{...
Trevor's user avatar
  • 1,749
9 votes
1 answer
672 views

I am using linux and the following version of the bash: GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) When I type: echo file{[1,2],3}.txt I expect brace expansion to be done first, so: ...
Yakog's user avatar
  • 517
2 votes
2 answers
211 views

I want to download all files named ${n}x${n} from a directory on a website with wget2 on zsh, where n is the same number value both times, with n from 1 to 6000. I've found that specifying all the ...
XDR's user avatar
  • 471
0 votes
1 answer
134 views

Consider the following example: $ echo file_{a,b,c} file_a file_b file_c # brace expansion worked :) $ export VARIABLE=file_{a,b,c} $ echo $VARIABLE file_c # brace ...
Thomas Fritz's user avatar
0 votes
2 answers
384 views

After seeing the reactions on Stack Overflow on this question and an unfamiliarity with qsub, I believe thqt U&L is better suited for this question. In qsub, we can pass environment variables (a ...
Bram Vanroy's user avatar
3 votes
3 answers
883 views

I just learned about brace expansion and hoped I could make use of them to launch the same C++ program with different command line arguments. My code is run like this from the terminal: mpirun -n 1 ...
reloh100's user avatar
0 votes
1 answer
312 views

#!/bin/bash myfirstarray=(1 3 5 7 9 11) for i in {2..4} do for j in {1..${myfirstarray[$((i-1))]}} do echo ${j} done done In the code above the range of the ...
wing47299's user avatar
4 votes
1 answer
444 views

This is the output of tree: [xyz@localhost Semester1]$ tree . ├── Eng ├── IT ├── IT_workshop ├── LA ├── OS ├── OS_lab ├── Psy ├── Python └── Python_lab 9 directories, 0 files I want to create 3 ...
Random Person's user avatar
2 votes
1 answer
586 views

I have this function: cyan=`tput setaf 6` reset=`tput sgr0` function Info() { echo "${cyan}$1${reset}" } And I use it in my other scripts as simple as Info some message. However, when I ...
Saeed Neamati's user avatar
8 votes
2 answers
4k views

Say I have two possible paths I want to list directories and files under on a Linux machine: /some/path1/ /some/path2/ If I do the following in tcsh, I get 0 exit code, if at least one of path1 or ...
shikhanshu's user avatar
4 votes
3 answers
1k views

I want to store node1 node2 node3 in a variable so that it may be used as an input to other scripts. However, I want to do so by using brace expansion given by bash like so: node{1..3} I tried to have ...
Murtaza Raja's user avatar
0 votes
1 answer
100 views

I would like to use Bash brace expansion and get the final result quoted between double quotes: I managed to get that result only by using seq as follows: echo '"'$(seq 1 5)'"'; output (...
Amazigh_05's user avatar
2 votes
2 answers
76 views

{txtfile,index}{1..3}.{txt,html} I want {txtfile,index} to correspond with {txt,html} to produce: txtfile1.txt txtfile2.txt txtfile3.txt index1.html index2.html index3.html but this code will generate ...
Mr. Doge's user avatar
  • 121
2 votes
2 answers
138 views

Example: $ eval echo "{x,y,z}\ --opt\; " x --opt; y --opt; z --opt; Assume that the 2nd list is {1,2,3} and its length is equal to the length of the 1st (initial) list. Questions: How to ...
pmor's user avatar
  • 757

15 30 50 per page
1
2 3 4 5
11