home

Quickies, by Andrea Olivato

text

Brace expansions examples in bash

A bunch of self-explaining examples using brace

# Just echo
echo {John,Jane,Baby,Precious}
	#John Jane Baby Precious

# Combine
echo {John,Jane,Baby,Precious}Doe
	#JohnDoe JaneDoe BabyDoe PreciousDoe

# Combine with with spaces
echo {"John ","Jane ","Baby ","Precious "}Doe
	#John Doe Jane Doe Baby Doe Precious Doe

# Combine with with spaces and commas
echo {"John ","Jane ","Baby ","Precious "}Doe,
	#John Doe, Jane Doe, Baby Doe, Precious Doe,

# Double Combined
echo Dear{" John "," Jane "," Baby "," Precious "}Doe,
	#Dear John Doe, Dear Jane Doe, Dear Baby Doe, Dear Precious Doe,

# Triple multiple combination ( :) )
echo Hello{{" Mr "," Dr "}John,{" Ms "," sweet "}Jane,{" little "," cute "}Baby," Precious"}" Doe,"			
	#Hello Mr John Doe, Hello Dr John Doe, Hello Ms Jane Doe, Hello sweet Jane Doe, Hello little Baby Doe, Hello cute Baby Doe, Hello Precious Doe,

2 years ago

July 29, 2009
Comments (View)
blog comments powered by Disqus