Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Auto insert command options

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: Auto insert command options

#16 Post by Head_on_a_Stick »

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
deadbang

xepan
Posts: 89
Joined: 2018-11-28 06:38

Re: Auto insert command options

#17 Post by xepan »

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.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: Auto insert command options

#18 Post by Head_on_a_Stick »

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?).
deadbang

xepan
Posts: 89
Joined: 2018-11-28 06:38

Re: Auto insert command options

#19 Post by xepan »

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.

Post Reply