Tsallaka zuwa abun ciki
Justice Tech School

Globbing and Brace Expansion

* matches any text, ? one character, [] a set and {a,b} lists alternatives.

Example
d=$(mktemp -d); cd "$d"
touch a1.txt a2.txt b1.log
echo *.txt
echo ?1.*
echo [ab]1.*
echo file_{x,y,z}.c
cd /; rm -r "$d"

Result

a1.txt a2.txt
a1.txt b1.log
a1.txt b1.log
file_x.c file_y.c file_z.c

Exercise

One character.

ls a.txt

Quiz Test

What does {a,b} do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.