1

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.

2 Answers 2

6

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.

1
  • Thank you very much. Also, thanks for the very kind RTFM :) Feb 18, 2012 at 16:59
1

Maybe you want this:

touch app/views/pages/{_sponsors,_donations,_volunteers}.html.erb

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .