• Bash - Can I create cascading aliases, that is an alias of an alias?

    From Ottavio Caruso@21:1/5 to All on Fri Apr 29 15:44:32 2022
    Hi,

    Assuming:

    alias yt='/home/user/bin/yt-dlp'

    and I want have more aliases incorporating this alias:

    alias yt-native='yt --hls-prefer-native"
    alias alias yt-auth='yt -u user@email.com -p password"

    so that I don't have to repeat the location of yt-dlp.

    Is that possible?

    --
    Ottavio Caruso

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Fenris@21:1/5 to Ottavio Caruso on Fri Apr 29 16:13:28 2022
    On 2022-04-29, Ottavio Caruso <ottavio2006-usenet2012@yahoo.com> wrote:
    Assuming:

    alias yt='/home/user/bin/yt-dlp'

    and I want have more aliases incorporating this alias:

    alias yt-native='yt --hls-prefer-native"
    alias alias yt-auth='yt -u user@email.com -p password"

    so that I don't have to repeat the location of yt-dlp.

    Is that possible?

    So why don't you just try it?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Elvidge@21:1/5 to Ottavio Caruso on Fri Apr 29 19:45:33 2022
    On 29/04/2022 15:44, Ottavio Caruso wrote:
    Hi,

    Assuming:

    alias yt='/home/user/bin/yt-dlp'

    and I want have more aliases incorporating this alias:

    alias yt-native='yt --hls-prefer-native"
    alias alias yt-auth='yt -u user@email.com -p password"

    so that I don't have to repeat the location of yt-dlp.

    Is that possible?


    You type this _once_ into your .bash_aliases!
    You could even repeat lines. Too much trouble?
    Or are you just trolling?


    --
    Chris Elvidge
    England

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eli the Bearded@21:1/5 to ottavio2006-usenet2012@yahoo.com on Sat Apr 30 01:13:24 2022
    In comp.unix.shell, Ottavio Caruso <ottavio2006-usenet2012@yahoo.com> wrote:
    Hi,

    Assuming:

    alias yt='/home/user/bin/yt-dlp'

    and I want have more aliases incorporating this alias:

    alias yt-native='yt --hls-prefer-native"
    alias alias yt-auth='yt -u user@email.com -p password"

    Yes. I'd say that method sucks, however. Personally I use a wrapper
    script for yt-dlp that sets my preferred options and gives me handy
    command line shortcuts.

    But you can do some fun stuff with aliases.

    When an alias definition ends with a space, the following term can also
    be an alias. The typical use-case is an alias with nice, time, sudo or
    the like that you would prefix to a regular comandline.
    It can also be used to rename options.

    alias yt='/home/user/bin/yt-dlp '
    alias _native='--hls-prefer-native '
    alias _auth='-u user@email.com -p password '
    alias e='echo '

    Now you can chain them, and order doesn't matter.

    $ e yt _native _auth
    /home/user/bin/yt-dlp --hls-prefer-native -u user@email.com -p password
    $ e yt _auth _native
    /home/user/bin/yt-dlp -u user@email.com -p password --hls-prefer-native
    $

    But seriously, write a wrapper script.

    Elijah
    ------
    includes preferred destination directory and site-based rules in his

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Eli the Bearded on Sat Apr 30 05:40:17 2022
    On 30.04.2022 03:13, Eli the Bearded wrote:
    In comp.unix.shell, Ottavio Caruso <ottavio2006-usenet2012@yahoo.com> wrote:
    Hi,

    Assuming:

    alias yt='/home/user/bin/yt-dlp'

    and I want have more aliases incorporating this alias:

    alias yt-native='yt --hls-prefer-native"
    alias alias yt-auth='yt -u user@email.com -p password"

    [...]

    But seriously, write a wrapper script.

    Or just use shell functions to avoid the restrictions of aliases and
    get the advantages of both.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ottavio Caruso@21:1/5 to Eli the Bearded on Sat Apr 30 10:45:40 2022
    On 30/04/2022 02:13, Eli the Bearded wrote:
    In comp.unix.shell, Ottavio Caruso <ottavio2006-usenet2012@yahoo.com> wrote:
    Hi,

    Assuming:

    alias yt='/home/user/bin/yt-dlp'

    and I want have more aliases incorporating this alias:

    alias yt-native='yt --hls-prefer-native"
    alias alias yt-auth='yt -u user@email.com -p password"

    Yes. I'd say that method sucks, however. Personally I use a wrapper
    script for yt-dlp that sets my preferred options and gives me handy
    command line shortcuts.

    But you can do some fun stuff with aliases.

    When an alias definition ends with a space, the following term can also
    be an alias.


    Ah, thanks. That's the one I was looking for. It's buried somewhere in
    the man page (hints are welcome) but I can't find it. However...

    But seriously, write a wrapper script.

    I agree.



    --
    Ottavio Caruso

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David W. Hodgins@21:1/5 to Ottavio Caruso on Sat Apr 30 13:15:07 2022
    On Sat, 30 Apr 2022 05:45:40 -0400, Ottavio Caruso <ottavio2006-usenet2012@yahoo.com> wrote:
    Ah, thanks. That's the one I was looking for. It's buried somewhere in
    the man page (hints are welcome) but I can't find it. However...

    In GNU bash, version 5.1.4(1)-release the text in "man bash", the first paragraph
    in the ALIASES section ends with ...

    If the last character of the alias value is a blank, then the next command
    word following the alias is also checked for alias expansion.

    Regards, Dave Hodgins

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ottavio Caruso@21:1/5 to David W. Hodgins on Tue May 3 10:19:51 2022
    On 30/04/2022 18:15, David W. Hodgins wrote:
    On Sat, 30 Apr 2022 05:45:40 -0400, Ottavio Caruso <ottavio2006-usenet2012@yahoo.com> wrote:
    Ah, thanks. That's the one I was looking for. It's buried somewhere in
    the man page (hints are welcome) but I can't find it. However...

    In GNU bash, version 5.1.4(1)-release the text in "man bash", the first paragraph
    in the ALIASES section ends with ...

    If the last character of the alias value is a blank, then the next command
           word following the alias is also checked for alias expansion.

    Regards, Dave Hodgins

    Thanks.

    --
    Ottavio Caruso

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)