Monday, 4 March 2019

Bash brace expansion

Some examples of Bash's brace expansion.

The values inside the braces are repeated

echo a{b,c,d}e
abe ace ade
And you can embed braces within braces

echo a{b,c,d{e,f}}g
abg acg adeg adfg
Or it can be a sequence inside the braces

echo a{1..10}b
a1b a2b a3b a4b a5b a6b a7b a8b a9b a10b
Also includes an optional increment

echo a{1..10..2}
a1b a3b a5b a7b a9b
A simple real world example

mkdir -p james/{{logs,err}/{server1,server2},src,bin}

This makes the following directories:
james
james/logs
james/logs/server1
james/logs/server2
james/err
james/err/server1
james/err/server2
james/src
james/bin

Oracle CPU downloader

Every quarter I have to go through and download numerous patches for the Oracle CPU (Critical Patch Update). You have to view the CPU docume...