Auto insert command options

New to Debian (Or Linux in general)? Ask your questions here!

Re: Auto insert command options

Postby Head_on_a_Stick » 2018-12-08 10:44

Soapm 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?

Yes, it is possible :)

See https://mywiki.wooledge.org/BashGuide/T ... _.7C.7C.29 & https://mywiki.wooledge.org/BashGuide/T ... _.5B.5B.29
"French riots get results! U lot are instagram zzzombies" — graffiti over Euston underpass
User avatar
Head_on_a_Stick
 
Posts: 8583
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Auto insert command options

Postby xepan » 2018-12-08 16:12

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.
...
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.

The bot is slightly more unfriendly in recommending against aliases in favor of functions.

So i tend to agree with pendrachken:
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.
xepan
 
Posts: 83
Joined: 2018-11-28 06:38

Re: Auto insert command options

Postby Head_on_a_Stick » 2018-12-08 16:29

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.

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.

But yes, I would generally agree that functions are far more flexible and useful than aliases (aliai?).
"French riots get results! U lot are instagram zzzombies" — graffiti over Euston underpass
User avatar
Head_on_a_Stick
 
Posts: 8583
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Auto insert command options

Postby xepan » 2018-12-08 16:41

Just chatting.
In general i was wondering if aliases can do tests/conditionals, they seem to, and then if that would be a stretch or not.
I sure never saw it in aliases, a quick web-search was not successful either, but i wouldn't really know.
xepan
 
Posts: 83
Joined: 2018-11-28 06:38

Previous

Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 11 guests

fashionable