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

Defmacro that expands to defsetf

I'm having some trouble with some nested backquotes in CL. I'm trying to create a macro define-access that takes two parameters, F and A. define-access should define a function and setf expansion for symbol F that acts just like the respective…
Silvio Mayolo
  • 62,821
  • 6
  • 74
  • 116
2
votes
3 answers

foreach: grep backtick in for-loop

How would one grep backtick from files in a for-loop. I would like to run grep for a pattern '`define'. The pattern works in standalone grep command but fails in for-loop. foreach xxx ( `grep -r '`define' $idirectory --no-filename | sed -e 's ;…
user1495523
  • 475
  • 2
  • 7
  • 17
2
votes
1 answer

Valid commands to be used in backticks in bash?

Consider the two commands, command1="mysql -umyuser -pmypassword -e \"show databases;\";" command2="cat stackoverflow.txt" The strings are formed as follows, echo ${command1} -> mysql -umyuser -pmypassword -e "show databases;"; echo ${command2} ->…
Suvarna Pattayil
  • 5,136
  • 5
  • 32
  • 59
2
votes
1 answer

Using backticks and pipes in Ruby

This bug appears when using shell commands in a ruby script. The commands are not executed as what would happen in the bash terminal. The first two commands are reasonable, the third is not. `echo foo` # => "foo\n" `echo -n foo` # => "foo" `echo -n…
2
votes
1 answer

Why are SQL fieldnames sometimes spelled like `this`?

What's the difference between SELECT * FROM `this` and SELECT * FROM this ?
Gal
  • 23,122
  • 32
  • 97
  • 118
2
votes
1 answer

Why does my shell command with nested backticks fail?

I have a shell script containing this: var1=`expr $RANDOM % 100` var2=`expr $RANDOM % 1000 \* 60` ... ... sleep `expr $var2- `date -t` + $var1` It gives me this error: sleep:invalid number of operands expr error: invalid syntax + cannot execute no…
nya
  • 33
  • 1
  • 1
  • 4
2
votes
1 answer

Resolving Perls "$?" return code: Why is it different from Hana sql error code ??

I have written a perl script that connects to hdbsql a commandline tool on SAP HANA. Hdbsql to SAP Hana is what sqlplus is to Oracle. I am using backtick to fire a sql query on hdbsql and i am capturing the result of the query in an array.…
Chiseled
  • 2,280
  • 8
  • 33
  • 59
2
votes
1 answer

Perl opening dynamically generated files

I am using CGI script for my website. And I have problem with opening a dynamically generated file. Here is the code: #!/usr/bin/perl my @output = `/export/es_share/Zhou/./notification_finder.sh range $date $time $range $ulh TestProd1…
Juto
  • 1,246
  • 1
  • 13
  • 24
2
votes
2 answers

index function not working with backtick output?

I'm trying to test if a backtick output string (it is a string, right?) contains a substring. my $failedCoutner = 0; my $tarOutput = `tar -tvzf $tgzFile`; print "$tarOutput\n"; my $subStr = "Cannot open: No such file or directory"; if…
geeoph
  • 349
  • 2
  • 4
  • 10
1
vote
1 answer

cshell: running cat on a large text file inside backticks gives 'word too long'

I have a file that has fairly long lines. The longest line has length 4609: % perl -nle 'print length' ~/very_large_file | sort -nu | tail -1 4609 Now, when I just run cat ~/very_large_file it runs fine. But when I put inside backticks, it gives a…
Unos
  • 1,293
  • 2
  • 14
  • 35
1
vote
1 answer

backtick operator return status code 5 (or 1280)

I needed to replace a radius autentification script (for PPPoE connections). This is a heavily used service that runs 24/7, so to test the new script I injected a small code in the begining of the original script to fork a new process that called…
Radu Maris
  • 5,648
  • 4
  • 39
  • 54
1
vote
3 answers

how to get text via backticks or system in Perl

I want to call a EXE file in Perl which performs some action I tried calling the exe file via backtick and system but in both the cases i get only the return value The exe file prints some text on to the console. Is it possible to capture that as…
KK99
  • 1,971
  • 7
  • 31
  • 64
1
vote
3 answers

Dynamic Perl find and replace using grep inside backticks

I am trying to do a dynamic search and replace with Perl on the command line with part of the replacement text being the output of a grep command within backticks. Is this possible to do on the command line, or will I need to write a script to do…
Dominique
  • 374
  • 4
  • 16
1
vote
1 answer

Rename a MySQL column containing ` in the column name

So, the other guy at work created a table with a column called: Max(`abs_spg_20090430`.`ID`) this is giving me an error now that I am trying to run a dump of the database on a different server. I am trying to rename it, but ALTER TABLE…
1
vote
2 answers

Bash and MySQL variables error

I have the following script: #!/bin/sh Q=`
David Adders
  • 138
  • 3
  • 11