[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] Dateiendung-Zuweisung unter Bash.



* Timo Eckert <eckert@ipexmedia.com> wrote:
> Also, weiss jemand von euch, ob es möglich ist, Dateiendungen 
> Programmen zuzuordnen? Also quasi ein Alias?
> 
> Ich such halt sowas wie, wenn ich unter der Bash "01234.mp3" eingeben,
> dass dies mir automatisch "xmms 01234.mp3" draus macht, usw.

Mit der Zsh ist das möglich:

  alias [ {+|-}gmrsL ] [ name[=value] ... ]

    [...]
    If  the  -s flags is present, define a suffix alias: if the com-
    mand word on a command line is in the  form  `text.name',  where
    text  is any non-empty string, it is replaced by the text `value
    text.name'.  Note that name is treated as a literal string,  not
    a  pattern.   A  trailing  space in value is not special in this
    case.  For example,

       alias -s ps=gv

    will cause the command `*.ps' to be expanded to `gv  *.ps'.   As
    alias expansion is carried out earlier than globbing, the `*.ps'
    will then be expanded.
    [...]

Also: alias -s mp3=xmms

Gruß, Georg
-- 
Es ist ein Irrtum zu glauben, man koenne jedes groessere Problem einfach
mit Kartoffeln loesen.  (Douglas Adams - Per Anhalter durch die Galaxis)



Reply to: