Categories
Linux Tutorial Series

Linux Tutorial Series – 57 – Brace expansion

Here is the video version, if you prefer it:

Brace expansion is used to pass multiple arguments to a command. (Barrett, 2016)⁠ An example:

mislav@mislavovo-racunalo:~/Linux_folder$ echo my{File1,File2,File3}

myFile1 myFile2 myFile3

So the shell performed its expansion and I have 3 filenames because of that. Note that there are no spaces between the commas and the next letter. If I put a space, I would get:

mislav@mislavovo-racunalo:~/Linux_folder$ echo my{File1, File2, File3}

my{File1, File2, File3}

Useful to know.

Hope you learned something new!

References

Barrett, D. J. (2016). Linux pocket guide (3rd ed.). O’Reilly Media. Page 30

NewsletterUpdates on interesting things I am doing

Subscribe to my newsletter to keep abreast of the interesting things I'm doing. I will send you the newsletter only when there is something interesting. This means 0% spam, 100% interesting content.

Leave a Reply

Your email address will not be published.