You are not logged in.
[dezza@dezza Zen Mechanics - Holy Cities (FLAC) (2008)]$
alias flac2mp3="flac -sdc $1 | lame -V2 --vbr-new - $2"
[dezza@dezza Zen Mechanics - Holy Cities (FLAC) (2008)]$
flac2mp3 "01. Zen Mechanics - Modified.flac" Modified.mp3
lame: excess arg Modified.mp3
How can it be that it works like "flac -sdc $1 | lame -V2 --vbr-new - $2" but not when wrapped into an alias?
Thanks in advance!
Last edited by dezza (2009-06-10 22:13:21)
Offline
An alias doesn't know anything about $1 or $2.
However - you _could_ make it into a function - thus:
flac2mp3() { flac -sdc $1 | lame -V2 --vbr-new - $2; }
Last edited by perbh (2009-06-11 12:38:30)
Offline
But I have another alias where I use $1 in it and it works fine?
Offline
But I have another alias where I use $1 in it and it works fine?
It may be an illusion. like alias play=mplayer $1
When you run `play hahaha.mp3` it will actually try `mplayer $1 hahaha.mp3`, will fail to find `$1` as a file, and start `hahaha.mp3`.
I have a hunch this is the case. Alias has no parameter parsing afaik (make a script for that instead)
MacGregor DESPITE THEM!
7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Offline
Considering what you're trying to do, i thoroughly recommend you quote those parameters
flac2mp3() { flac -sdc "$1" | lame -V2 --vbr-new - "$2"; }
^ ^ ^ ^
It will probably save you some headaches from filenames with spaces in them...
Stand back, intruder, or i'll blast you out of space! I am Klixon and I don't want any dealings with you human lifeforms. I'm a cyborg!
Offline
Interesting .. You might be right ..
But if I assign the function first:
flac2mp3() { flac -sdc $1 | lame -V2 --vbr-new - $2; }
What should the alias line look like? And will the function be there for the next time I open up a terminal?
Offline
Put the function in your ~/.bashrc, and run it with "flac2mp3". You don't need an alias.
Offline