Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm on Ubuntu 10.04 and I've ran into a little bit of a snag with bash completions within backticks. Here's an example to illustrate:

I save streaming URL:s to my radio-stations in text files, and I usually start listening by typing

$ mplayer `cat ~/stations/some.fm`

It would be great if I could use tab completion at:

$ mplayer `cat ~/stations/<tab>

In this case, however, the tab completion doesn't seem to match files, only directories. So I get

$ mplayer `cat ~/stations/<tab>
subdir1       subdir2
$ mplayer `cat ~/stations/

But no files! A workaround is to use

$ cat ~/stations/some.fm | xargs mplayer

In this case tab completion works, but I would prefer to use the backtick version. Not for this example alone, but this bit me in many other situations as well.

Does anyone here know how to fix this / where the filter is defined?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Use:

$ mplayer $(cat ~/stations/<tab>

instead; it does the same thing.

share|improve this answer
    
Great! This works. Curious why backticks don't though. Any ideas? –  Alexander Torstling Sep 10 '10 at 11:32
    
Maybe because backticks are old-style now, but I sill prefer them. –  cYrus Sep 10 '10 at 12:45
    
@you both: Yes, the reason is because the backticks are old-school and $() is the new backtick. But, as an old fart, I also prefer backticks. –  Janne Pikkarainen Sep 10 '10 at 13:02
    
Backticks aren't necessarily old-school (even sh supports $()); the problem is that it's hard to know when it's a opening or closing one. Nesting is a hell. –  grawity Sep 10 '10 at 19:49
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.