Questions tagged [backticks]

For questions relating to the backtick character (`), also known as the backquote, which has various special meanings in computing.

A backtick or backquote or grave accent is the character,

       `

On British and American QWERTY keyboards, this is located in the upper left corner, next to the 1 key. It is notoriously difficult to type on some European keyboards, requiring up to four keystrokes.

Backticks were introduced by Unix shells to run a sub-shell. The concept has been adopted by other languages and tools such Perl, PHP, Ruby, and Make. The newer alternative syntax $(<command>) in POSIX-compliant shells is more flexible as it allows nesting.

In Python 2, backticks enclose an expression to be evaluated and converted to its string representation. This feature was removed in Python 3, as it was deemed not sufficiently beneficial to warrant the syntax. The same effect can be accomplished with repr() instead.

In Markdown, backticks are used as a shorthand for emitting <code></code> tags in HTML.

In TeX typesetting, a backtick renders as an opening curly quote (‘).

In the programming languages D and Go, backticks surround string literals.

Further uses of backticks in computing can be found in the Wikipedia article on the grave accent.

311 questions
1
vote
2 answers

sed in backtick expansion, with xargs, not substituting the input string

echo "who are you" | xargs -i@ echo `echo @ | sed "s/who/where/"` Expected output: where are you actual output: who are you Note - this is not actual use case but an example test case.
Jagga
  • 189
  • 2
  • 9
1
vote
1 answer

When is variable in backticks expanded using Bash shell?

If I have a variable in backticks is it expanded in the shell or in the subshell? For example: FOO=BAR BAZ=`[[ $FOO == BAR ]] && echo 1 || echo 0` Is it defined when $FOO is expanded? For example does the subshell see this: [[ $FOO == BAR ]] &&…
newguy
  • 617
  • 6
  • 15
1
vote
1 answer

Backticks in snippets for Emacs

I am trying to create a code block snippet for Markdown in Emacs. I tried to create a snippet like so: # -*- mode: snippet -*- # name: code-block # key: cb # --- ```${1:r} ${2:code} ``` but when I tried to save, it threw an error saying wrong…
TheRimalaya
  • 4,232
  • 2
  • 31
  • 37
1
vote
1 answer

Use of backticks (``) in JS results in empty lines

I have used the backticks syntax in order to generate some Java code with Javascript: ${body ? `con.setDoOutput(true); DataOutputStream wr = new…
1
vote
1 answer

ksh not evaluating variable within backticks

This one has me stumped. #!/bin/ksh AWKSCRIPT='END { print "all done"; }' OUTPUT=`echo hello world | awk '$AWKSCRIPT'` RETVAL=$? echo "running echo hello world | awk '$AWKSCRIPT'" echo "Output = $OUTPUT" echo "returned = $RETVAL" The output…
symcbean
  • 47,736
  • 6
  • 59
  • 94
1
vote
1 answer

Word splitting within backticks

What is the difference between line #2 and line #4 in the script ("foo bar" (without quotes) folder exists): FOOBAR="foo bar" echo `ls -la "$FOOBAR"` args="-la \"$FOOBAR\"" echo `ls $args` Output: total 0 drwxr-xr-x 2 tervlad LD\Domain Users 68 15…
tereshinvs
  • 13
  • 2
1
vote
1 answer

Using telnet with pipe with backticks in perl

I am trying to test a specific server is up and running on a certain port so I am using $result = `echo exit | telnet 127.0.0.1 9443`; print $result; Here I am using localhost for privacy issues The expected behavior is that it should print…
1
vote
2 answers

MySQL - add leading underscore on reserved keywords for columns?

Is it safe to add leading underscores on reserved keywords for columns? For instance: _key There too many reserved keywords and it is hard to avoid. For instance currently I am using code to replace key to avoid collision. But what happens if one…
Run
  • 54,938
  • 169
  • 450
  • 748
1
vote
1 answer

Backticks creates jQuery error in mobile browser

I have a text which was retrieved from my database with PHP and has characters like " ' and also has line breaks. Now I passed it to a jQuery string using the backticks like this var str = ``; And it works fine with desktop…
user6459745
1
vote
2 answers

how to get html/css snipits in backticks when using typescript for AngularJS

i know this might kind of sound dumb but whenever i write templates in Angular 2 my html just shows up as gray text and i cant do things like autocomplete and stuff. Same issue with the CSS Is there a plugin to solve this or is this a settings…
jeremy
  • 433
  • 1
  • 8
  • 30
1
vote
1 answer

quote back-tick quote...enclosed in back-ticks

I have a code snippit like: console.log('`', '...') The first argument to log here is quote, back-tick, quote. I would like to embed this in a sentence in a markdown document like: this code `code` is foo. But, when I try this: this code…
Jonathan.Brink
  • 23,757
  • 20
  • 73
  • 115
1
vote
1 answer

plist creating with backticks fails in let expression

I have a twofold question and hope for advice from the experts here. 1) In a syntactic analysis of some code, I need to store the components found for later use. I now consider storing these as property list (an isolated one, not the one of the…
user52366
  • 1,035
  • 1
  • 10
  • 21
1
vote
1 answer

Why echo a backticks-row?

I "inherited" some code in a project, and in one of the Bash scripts, they use echo on a backticks-row, like: #!/bin/bash echo `/path/command argument` What's the difference between that and just running the command…
Puggan Se
  • 5,738
  • 2
  • 22
  • 48
1
vote
2 answers

Nest backticks inside a git command alias

I'm attempting to make a git alias to show all commits since the last tag. I'm basing it of this SO answer that I've used a lot in the past. Currently, I'm trying this with a git config --global alias.* command like so: git config --global…
matthewrdev
  • 11,930
  • 5
  • 52
  • 64
1
vote
2 answers

Bash: escape characters in backticks

I'm trying to escape characters within backticks in my bash command, mainly to handle spaces in filenames which cause my command to fail. The command I have so far is: grep -Li badword `grep -lr goodword *` This command should result in a list of…
Ian McIntyre Silber
  • 5,553
  • 13
  • 53
  • 76