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.

In zsh, I can specify default program to open which file extension like alias -s {mkv,mpg}='mplayer' . I runs fine but what I really want is to run mplayer <filename> & so it won't produce technical stuffs and 'stealing' my current shell session.

How can I make this happen ?

Thanks for reading :)

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You either provide a wrapper script or a function doing what you need, e.g:

background() {
  "$@" &
}

and use the function/script instead:

alias -s {mkv,mpg}='background mplayer'
share|improve this answer
    
can you explain me or provide a document which explains me how the function work ? Thanks –  nXqd Jun 4 '12 at 6:52
1  
See gnu.org/software/bash/manual/bashref.html#Special-Parameters for $@. The function takes all arguments and executes it but will append & to the commandline. –  Ulrich Dangel Jun 4 '12 at 13:43

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.