💾 Archived View for g.codelearn.me › 2018-01-31-alias-variables.gmi captured on 2024-08-18 at 17:24:22. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

Bash. Variables inside aliases

Hey,

Recently I had to use bash alias that contains `$(pwd)` inside so I've defined it like that:

alias thename="something $(pwd) --option=value"

Of course I know a bit of bash so that's why I use double quotes!

But it turned out to be wrong. Each time when my bash/zsh was opened the alias was defined with **INTERPRETED** `$(pwd)` which is the directory where bash was opened (usualy home dir).

Actually we have to use single quotes to make sure that `$(pwd)` isn't interpreted at the moment of alias definition but it is when we call the alias.

Summary