Code: Select all
ffmpeg -i file.mp3 -af "volumedetect" -vn -sn -dn -f null /dev/null
Code: Select all
-af "volumedetect" -vn -sn -dn -f null /dev/null
Code: Select all
ffmpeg -i file.mp3 -af "volumedetect" -vn -sn -dn -f null /dev/null
Code: Select all
-af "volumedetect" -vn -sn -dn -f null /dev/null
Code: Select all
ownecho () { echo "$@" blabla ; }
Code: Select all
source .bashrc
Code: Select all
ownecho hello
Code: Select all
# mappings for "page up" and "page down" to step to the beginning/end
# of the history
# "\e[5~": beginning-of-history
# "\e[6~": end-of-history
# alternate mappings for "page up" and "page down" to search the history
"\e[5~": history-search-backward
"\e[6~": history-search-forward
You seem a bit over my head, I use joe as my text editor and am familiar with editing my bash using;cronoik wrote:Just add a function to your .bashrc:
Code: Select all
ownecho () { echo "$@" blabla ; }
Code: Select all
source .bashrc
Code: Select all
ownecho hello
Code: Select all
joe ~/.bashrc
Code: Select all
alias rip='time ripdvd.sh &'
My command line already remembers commands using page up and down, I'm just looking to have it enter the last portion of the command. Just the part with the options since I have to manually enter ffmpeg -i filename.mp3. I just want it to add this to the end;xepan wrote:If you edit /etc/inputrc and change to this:then you can type the beginning of the command, say "ffm", then hit page up, and it will complete whatever in your history started with "ffm" (hit page up as often as it takes, or make the beginning more unique).Code: Select all
# mappings for "page up" and "page down" to step to the beginning/end # of the history # "\e[5~": beginning-of-history # "\e[6~": end-of-history # alternate mappings for "page up" and "page down" to search the history "\e[5~": history-search-backward "\e[6~": history-search-forward
iirc debian's inputrc has that entry, but commented.
In this case you probably want a function as proposed by cronoik though.
Code: Select all
-af "volumedetect" -vn -sn -dn -f null /dev/null
I'm sorry, English is not my mother tongue and therefore I tend keep my answer's unintentionally short. I have edited my post above to make it more clear.Soapm wrote:You seem a bit over my head,...
You're fine and appreciated, I got it to work but im not sure how it helps me.cronoik wrote:I'm sorry, English is not my mother tongue and therefore I tend keep my answer's unintentionally short. I have edited my post above to make it more clear.Soapm wrote:You seem a bit over my head,...
Code: Select all
ownffmpeg () { ffmpeg -i "$@" -af "volumedetect" -vn -sn -dn -f null /dev/null ; }
Code: Select all
source .bashrc
Code: Select all
ownffmpeg file.mp3
Soapm wrote:You seem a bit over my head, I use joe as my text editor and am familiar with editing my bash using;cronoik wrote:Just add a function to your .bashrc:
Code: Select all
ownecho () { echo "$@" blabla ; }
Code: Select all
source .bashrc
Code: Select all
ownecho hello
However, I can't visualize the command you're proposing entering into the file to make it output the options part of the command nor do I know what to type on the cli to activate it..Code: Select all
joe ~/.bashrc
I am familiar with aliases like the one I use to rip dvd's;
I just move to the directory and type "rip" and there it goes. Are you suggesting something similar to this?Code: Select all
alias rip='time ripdvd.sh &'
Code: Select all
myscript mymp3.mp3
Code: Select all
# ~/.bashrc
alias voldt='ffmpeg -af "volumedetect" -vn -sn -dn -f null /dev/null -i'
Code: Select all
voldt $name_of_mp3
Yup, i was aware that in your case it is not that helpful. Use autocomplete command from history via page-up, but then you have to edit that command.Soapm wrote: My command line already remembers commands using page up and down, I'm just looking to have it enter the last portion of the command. Just the part with the options since I have to manually enter ffmpeg -i filename.mp3. I just want it to add this to the end;
Code: Select all
-af "volumedetect" -vn -sn -dn -f null /dev/null
Gotcha, I guess I was viewing the steak through the tail end of the cow... thanks.xepan wrote:Yup, i was aware that in your case it is not that helpful. Use autocomplete command from history via page-up, but then you have to edit that command.Soapm wrote: My command line already remembers commands using page up and down, I'm just looking to have it enter the last portion of the command. Just the part with the options since I have to manually enter ffmpeg -i filename.mp3. I just want it to add this to the end;
Code: Select all
-af "volumedetect" -vn -sn -dn -f null /dev/null
That's why i said the proposed usage of a function is the better solution for your problem (#bash proposes to always use functions instead of aliases, but i don't really understand the reasoning).
I only mentioned it because i thought you wouldn't know it at all . And it saves a lot of typing in the long run. I hardly type more than the beginning of my usual commands and oneliners.
If you could put "-i filename" at the end", then it would work comfortable too, of course ("ffm", page-up, remove filename and insert other filename, hit enter).
Thanks for all the tips guys, it's been so long since I set up those aliases that I just forgot how to apply them in a different scenario. This is why I got off google and came here, I see my options are about unlimited with scripts, aliases etc...Head_on_a_Stick wrote:This would also work as an alias:Then useCode: Select all
# ~/.bashrc alias voldt='ffmpeg -af "volumedetect" -vn -sn -dn -f null /dev/null -i'
^ Replace $name_of_mp3 with the name of the mp3 trackCode: Select all
voldt $name_of_mp3
Yes, it is possibleSoapm wrote:Is it possible to put an "IF" statement in a, alias or command line, like IF the file needs normalizing then run the second command to normalize the file up to 0db?
Aliases are limited in power; the replacement only happens in the first word. To have more flexibility, use a function. Aliases are only useful as simple textual shortcuts.
...
Functions in Bash are somewhat like aliases, but more powerful. Unlike aliases, they can be used in scripts. A function contains shell commands, and acts very much like a small script; they can even take arguments and create local variables.
pendrachken wrote:You should be able to.
This is why I recommended a script though, it's easier to do what you want and have comments interspersed throughout to remind you of what tit is doing. That can you can just plop the script into the $PATH on any machine with BASH and ffmpeg and use it without having to either replace the stock .bashrc or cut / paste lines into the stock one to get the functionality back.
Yes but all the OP needed was a simple, textual shortcut and unless the user understands what "${@}" means then my alias is easier to interpret, understand and modify than your function.xepan wrote:The same guide says:Aliases are limited in power; the replacement only happens in the first word. To have more flexibility, use a function. Aliases are only useful as simple textual shortcuts.