Apologies if this is answered elsewhere, I could not for the life of me find a solution to my particular case, which is a bit strange I admit. (Note: all the “Using” words in this post appear blue for some reason, but they shouldn’t be and I don’t know how to prevent it).
I use bash in MacOS. I have a few aliases in my .bashrc that just print to the terminal window something to help me remember commands, or quickly show someone an example (in the code below I’m creating the alias on the command line, but in reality I always put aliases in .bashrc):
556 ~ alias howtotensorboard="echo tensorboard --logdir=logs/ --port=6001"
557 ~ howtotensorboard
tensorboard --logdir=logs/ --port=6001
If I use echo just on the command line, preceding a backtick with a backslash allows me to print a backtick to the window:
559 ~ echo Using \`which python\` etc
Using `which python` etc
But doing the same thing in an alias actually executes `which python` instead of printing it to the window:
560 ~ alias howtobacktick="echo Using \`which python\` etc"
561 ~ howtobacktick
Using /usr/bin/python etc
TL;DR, what I want is to put an alias in .bashrc that uses echo to print out a backtick, so that in the end I can do exactly this in bash:
558 ~ howtobacktick
Using `which python` etc
I’ve tried a bunch of variations within the alias in .bashrc and none of them have worked. How can I get the behavior I’m looking for? And, is there a way to do this specifically with echo?