2

What is the meaning of backticks before the bash command in the following manner?

```bash 
# Or
`bash

When I enter the following commands on my shell the following prompt appears

>

But if I enter

``bash

The > doesn't appear.

I came across this when following build-unix.md instructions for the bitcoin source code v0.15.1 in my text editor.

https://github.com/bitcoin/bitcoin/blob/v0.15.1/doc/build-unix.md

```bash
 BITCOIN_ROOT=$(pwd)

Thanks for your insights

  • There are no double backticks shown on (the formatted version of) that webpage. (Also, no BITCOIN_ROOT=$(pwd).) So which page are you really referencing? – roaima Mar 7 '18 at 8:50
  • Ah. Your version of the software seems to be at least a year old. I would strongly suggest you get the current version instead of 0.13. – roaima Mar 7 '18 at 8:58
  • @roaima I was reading the document from my text editor, not the webpage which is why I was shown the GitHub markdown language backticks. I edited my answer to make that more clear. I was referencening the v0.15.1 tag, I have the right software. Thanks! – user240070 Mar 7 '18 at 17:57
6

This is from github markdown language. This should not be copied into your terminal. In order to make a codeblock in github you surround your code with three backticks like so:

```
code
goes
here
```

In order to add syntax highlighting, you can specify the language like so:

```bash
code
goes
here
```

The code you want will be the stuff between the backticks.


The reason you are seeing the > prompt is because in bash the backticks are a special character used for command substitution. (It's an outdated way to do it but still works).

You can use it like:

$ echo `hostname`

it should be done like this

$ echo "$(hostname)"

Which will echo the hostname of your machine.

However when bash sees one backtick it interprets the rest of the statement as command substitution until it reaches a closing backtick. When you have three the first two close each other but the third opens opens a new substitution statement and bash is looking for a closing backtick. When you hit enter it displays a > to let you know you are still inside this block and allow you to enter multi-line commands. The same happens with quotes or the line escape character:

$ echo `
> hostname
> uname -s
> `
JBCGENS001 Linux

$ echo '
> hello
> world
> '

hello
world

$ echo \
> hello \
> world
hello world
  • Thanks for clearing that up! Would you also happen to know why I'm getting the > symbol after entering that input and what it means ? – user240070 Mar 7 '18 at 0:01
  • @HamsterDancer: I have updated my question – Jesse_b Mar 7 '18 at 0:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy