Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Any bash gurus know how to turn the commands below into a one liner?

trutch:$ touch app/views/pages/_sponsors.html.erb
trutch:$ touch app/views/pages/_donations.html.erb
trutch:$ touch app/views/pages/_volunteers.html.erb

I would like to be able to do something like this:

trutch:$ touch app/views/pages/[ARRAY].html.erb

If you have any sources for bash tricks such as this it would be appreciated as well.

share|improve this question
up vote 4 down vote accepted

Simple bash lists can be used for this:

touch app/views/pages/_{sponsors,donations,volunteers}.html.erb

Have a look at Bash One-Liners for tips, but the man page is also pretty detailed.

share|improve this answer
Thank you very much. Also, thanks for the very kind RTFM :) – Tyler Rutschman Feb 18 '12 at 16:59

Maybe you want this:

touch app/views/pages/{_sponsors,_donations,_volunteers}.html.erb
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.