huf [he/him]

  • 0 Posts
  • 19 Comments
Joined 3 years ago
cake
Cake day: November 11th, 2021

help-circle


  • when you create the alias, the shell substitutes the $1 (to nothing, probably) since your alias is in "" (double quotes).
    now, if you swap the single and double quotes, then the substitution still happens, but at invocation time instead of at definition time.
    you actually want perl to deal with this $1, so neither is good.

    you have three options:

    • write a function instead, as has been suggested
    • use $'' quoting, which lets you put ’ (single quote) inside ’ (single quote) without going mad: alias cica=$'foo \'$bar\' baz'
    • go insane and do this: alias cica='foo '\''$bar'\'' baz' (this is the old way, without bash’s $'')
















  • huf [he/him]@hexbear.nettoLinux@lemmy.mlStop Using Bash
    link
    fedilink
    English
    arrow-up
    5
    ·
    1 year ago

    yeah, consistency is way more important than whatever pet features people want.

    also, bash slow? what? it’s an interactive shell, the vast majority of time will be spent waiting for my input. unless you mean when you write scripts in bash? but surely nobody would do that when there’s perl…