Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

How may i merge these two lines into one line?

chown abc:abc *.sh

chown abc:abc *.txt

Change ownership of two file extensions into one liner.

share|improve this question

migrated from Sep 13 '11 at 9:38

This question came from our site for professional and enthusiast programmers.

up vote 6 down vote accepted

Like this:

chown abc:abc *.txt *.sh

Or if you really want to get fancy:

chown abc:abc *.{txt,sh}
share|improve this answer
+1, although "fancy" would be something like find . \( -name '*.txt' -or -name '*.sh' \) -maxdepth 0 -print0 | xargs -0 chown abc:abc {} ';' :-) – paxdiablo Sep 13 '11 at 3:35
@paxdiablo: no, you're confusing fancy with demented (ok, yes I'm guilty of using abominations like that, but I'm demented so it's ok). – Chris Sep 13 '11 at 3:36
Note that the brace syntax is not portable to basic Bourne shell. – tripleee Sep 13 '11 at 5:55
I realize it might be on purpose, but the find + xargs version is over-complicated. In particular, xargs -r0 chown abc:abc at the end is quite sufficient. – tripleee Sep 13 '11 at 5:57
@triplee: what does -r do on xargs? Darwin's xargs doesn't have that option... – w00t Sep 13 '11 at 12:05

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.