Have a situation where docker run .... is "wrapping" an unknown number of potential arguments so we can't use a function. If you're curious: https://github.com/dbt-labs/dbt-core/tree/main/docker#running-an-image-in-a-container
So I want to alias the docker run .... part of the docker run..... {real command} command.
alias my_command="docker run -e PASS='mypass' --some-setting" 'mypass' needs to be in single quotes.
With the above alias, alias my_command yields
alias mycommand='docker run -e PASS='\''mypass'\'' --some-setting' And this doesn't execute the right command. Specifically we get a permission denied. Running the exact same command straight, without the alias, works:
docker run -e PASS='mypass' --some-setting
my_command() { docker run -e PASS='mypass' --some-setting "$@"; }Enjoy..."$@". Thought we had to do$1,$2, .... Thanks!PAGER='less +/^\ *@' man bashalias my_commandlooks weird, but it's actually correct (at least, the part you gave looks correct). That weird'\''thing is one way to put a single-quote in a mostly-single-quoted string (which is how it's displaying the alias). See Nick Jensen's answer here. Is there something in the password itself that's wrong in thealias my_commandoutput, or is it just the weird-looking quoting?