Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to install all openoffice packages. Passing openoffice* obviously wouldn't work, because it'd look at file system. How can I do that?

share|improve this question
add comment

2 Answers

You can use shell globbing patterns as package names:

If no package matches the given package name(s), they are assumed to be a shell glob and any matches are then installed.

(from yum(8))

But you have to make sure that your shell does not consume your glob:

# yum install 'openoffice*'

Without the single quotes the shell expands the glob if your directory contains files whose filenames begin with 'openoffice'.

Alternative (inspect package list)

You can query all installable package that match openoffice* via:

$ yum list available 'openoffice*'

To extract those package names you can use repoquery:

$ repoquery --qf='%{name}' --pkgnarrow=available 'openoffice*'

Thus you could install those packages via:

# xargs yum install < output_from_prev_command.log

(Those steps give you the chance to inspect the list of all 'openoffice*' matching packages, e.g. to remove obvious unwanted packages.)

share|improve this answer
    
Note that instead of using "yum list available" (which is meant to be UI and not necessarily usable from sed) you are much better off using repoquery --pkgnarrow=available. –  James Antill Dec 10 '12 at 18:02
1  
@JamesAntill, thanks for the hint, updated the answer accordingly. –  maxschlepzig Dec 11 '12 at 10:01
add comment

Hmmm... I've checked it and

yum install openoffice*

works properly (wildcard is accepted)

share|improve this answer
1  
The * should be escaped, or it could match a file in the current directory containing "openoffice" in its name. –  WilQu Dec 6 '12 at 17:18
add comment

Your Answer

 
discard

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.