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
5
votes
1 answer

External program called with backticks still produces output

so I call an external program in perl and want to capture it's output: my @RNAalifoldOut = `RNAalifold some parameters`; If called from command line the output consists of three lines, e.g: 4 sequences; length of alignment…
NiklasMM
  • 2,895
  • 2
  • 22
  • 26
4
votes
4 answers

Asynchronously running perl's backticks

Right now I have a perl script that at a certain point, gathers and then processes the output of several bash commands, right now here is how I've done it: if ($condition) { @output = `$bashcommand`; @output1 = `$bashcommand1`; @output2 =…
Dlll
  • 95
  • 1
  • 5
4
votes
0 answers

How to render backticks in HTML inside a code chunk in rmarkdown?

In a .rmd file (output type = html document), I'm trying to render a HTML string containing a backtick (``) in a r code block, like in the following example: ```{r} htmltools::HTML('LEFT`RIGHT') ``` When I try to knit this, I get the…
4
votes
2 answers

Backticks in JavaScript file not auto closing in VSCode

When I am editing a JavaScript file inside VSCode and try using the backticks (`) it won't auto close. I want to have the same auto-closing feature that I have with the quotation marks, where if I type " I get: "|" (| = my cursor) I have tried…
4
votes
1 answer

Scala - Can Match-extraction be used on backtick identifiers?

The question is a little difficult to phrase so I'll try to provide an example instead: def myThing(): (String, String, String) = ("", "", "") // Illegal, this is a Match val (`r-1`, `r-2`, `r-3`) = myThing() // Legal val `r-1` = myThing()._1 The…
4
votes
1 answer

Perl backticks in hash ref giving different results

I have a file called a.gz which is a gzipped file which contains the following lines when unzipped: a b Below are two blocks of perl code which I think "should" give the same results but they don't. Code #1: use Data::Dumper; my $s = { …
fat_apupu
  • 64
  • 4
4
votes
1 answer

Unix shell replacing a word containing backtick in a file

I am having a sql file (samplesqlfile) and I want to replace a string which contains backticks with another string. Below is the code. actualtext="FROM sampledatabase.\`Datatype\`" replacetext="FROM sampledatabase.\`Datatype_details\`" sed -i…
user2349253
  • 109
  • 1
  • 10
4
votes
1 answer

What's the equivalent of Perl's backticks in Node.js?

In Perl you can do something like perl -E'my $date = `date`; say $date' This is a terse way to run a command synchronously and set the variable to STDOUT. In Node, how can I quickly run a command to capture the stdout?
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
4
votes
1 answer

What are the differences between backtick and single quote? Can I use IF statement in a query as above?

In the codeigniter manual writes the following. $this->db->select() accepts an optional second parameter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names with backticks. This is useful if you need a…
shin
  • 31,901
  • 69
  • 184
  • 271
4
votes
1 answer

Perl: suppress output of backtick when file not found

In my code : $status = `ls -l error*`; It shows output : ls *error No such file or directory. How can I suppress this message. I am interested in determining that the error files are generated or not. If yes, I need the list of files else ignore…
iDev
  • 2,163
  • 10
  • 39
  • 64
4
votes
3 answers

Perl - Breaking out of a system/backticks command on keypress if it takes a long time

I have a problem I am hoping someone can help with... I have a foreach loop that executes a backticks command on each iteration, such as greping a folder in a directory for a string (as shown below, greatly simplified for the purposes of explaining…
yonetpkbji
  • 1,019
  • 2
  • 21
  • 35
4
votes
3 answers

shell: Using sed in backticks

I want to escape some special chars inside a string automatically. I thought of echoing that string and pipe it through some seds. This doesn't seem to work inside of backticks. So why does echo "foo[bar]" | sed 's/\[/\\[/g' return foo\[bar] but…
Nico
4
votes
2 answers

Overriding backticks

So I wish to override backticks in a testing file, and have this apply to all scripts that are called during testing. The testing file employs several classes (saved in other files), and when these classes use backticks the override I have in the…
Robin
  • 737
  • 2
  • 10
  • 23
4
votes
1 answer

Perl qx execution order in array initialization

Assuming I have the following: my @net = (`echo "HELLO" > file`, `less file`); is it guaranteed that the order of execution is from 0..N (the first element in the array is executed first, then the second,etc..)? I've tested this, and…
snoofkin
  • 8,725
  • 14
  • 49
  • 86
4
votes
1 answer

perl system call won't recognize paths

I'm trying to execute a system command from a perl program. It works fine unless I provide a path, when it says " The system cannot find the path specified." I get the same results with exec(), system(), or backticks. I get the same results with…