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

Why do backticks, when used for saving command output, cause an EOF error?

I am looping through a list of clearcase files to see if the text "Merge <-" is not part of the output of ct describe. I have tried running a while loop on this list of clearcase files then appending it to another file if it meets my desired…
isakbob
  • 1,439
  • 2
  • 17
  • 39
1
vote
2 answers

Backticks work in ruby script when run from command line, but not from Crontab

I have a Ruby script with the command `notify-send "Error in EYW Spaces script" "#{Shellwords.escape(message)}"` If I just run the script from the command line, I get the popup message, but if I put the script into the crontab */5 * * * * ruby…
Jamie G
  • 156
  • 1
  • 8
1
vote
3 answers

How to split ``(Backtick string) on each instance of ${variable}

So my question is how i can split the a string with backtick on each instance of variable. I tried with \${.*?} but this will not work because ${variable} will be replaced by variable values first and than the split function will be executed. Any…
Code Maniac
  • 37,143
  • 5
  • 39
  • 60
1
vote
1 answer

Why isn't standard output displayed from a rake task called via backticks?

When a rake task is called via backpacks its output is suppressed: task :two do puts 'two' end task :one do puts 'one' `rake two` end -bash> bundle exec rake one one Whereas, the output is displayed when called via .invoke: task :one…
user664833
  • 18,397
  • 19
  • 91
  • 140
1
vote
3 answers

Nested backticks in bash script not working

I'm trying the following in a bash script: COUNT=`cat "$NEWLIST" | wc -l | awk \' { print $1 } \` ` where NEWLIST is a string containing a list of files, one per line. But I get this error: command substitution: line 74: unexpected EOF while…
mark
  • 4,678
  • 7
  • 36
  • 46
1
vote
1 answer

How to assign aliases to an array of column names with Joomla's quoteName()?

I want to use the AS statement for Aliases in a query. I use this piece of code: $query->select($db->quoteName(array('NameInQ as nin', 'Name'))); Anyway I get this error: 'Unknown column 'NameInQ as nin' in 'field list' NameInQ does exist as a…
Claudio Ferraro
  • 4,551
  • 6
  • 43
  • 78
1
vote
2 answers

Using backticks in bash script, to call python script into variable had previously worked, but is broken now

I have a simple script I have written for a game. This script is called from ~/.profile in the game user's home directory, and is supposed to simulate a fake login that runs another script upon successfully comparing two variables. It worked for a…
stelicho
  • 21
  • 8
1
vote
3 answers

How to escape quotation marks and curly brackets in template string

Im trying to change the language of the date-picker dynamically. To do so, I have to change the locale value of data-options. My plan is to use a template string to change it, whenever the variable currentLang changes. The problem is, that I can't…
Fabio ha
  • 553
  • 1
  • 8
  • 29
1
vote
0 answers

Sourcing a bash script and assigning a value to variable via backtick execution

I have a strange problem with bash that I cannot explain. I created the script test.sh which contains the lines: export TEST_HOME=`ls -d $HOME` echo $TEST_HOME if [ "$HOME" = "$TEST_HOME" ] then echo "Equal" else echo "Not equal" fi Now if I…
1
vote
1 answer

jq script with back tick in JSON value

I'm using jq inside a bash script, to parse a JSON returned by an API REST service This is my code (getting .count value) # getAPIId # Parse the answer of query API to get the API ID (checking version name) # return (echo to stdout) the…
Sourcerer
  • 1,891
  • 1
  • 19
  • 32
1
vote
1 answer

Curl command being printed instead of stored in Ruby

When I run this simple ruby script: a = `curl localhost` puts "Result is: #{a}" => % Total % Received % Xferd Average Speed Time Time Time CurrentDload Upload Total Spent Left Speed => 0 0 0 0 0 0 0 …
Scotty
  • 455
  • 7
  • 15
1
vote
1 answer

Perl : Implement timeout (& kill) for process invoked via backticks

I am trying to implement a routine which will take in a "command" and associated "timeout". If the command completes within the specified time, it should return the output. Or else - it should kill the process. sub runWithTimeout { my…
Soumya
  • 885
  • 3
  • 14
  • 29
1
vote
1 answer

Get both STDOUT and STDERR of a program or script to a variable in perl

I did lot of google to redirect the both STDOUT and STDERR of a program to a variable in perl, Initially i tried using both open and backticks, but failed to capture Error signal to the variable. I am posting this question because Now I got the…
Jerry James
  • 1,125
  • 1
  • 10
  • 17
1
vote
1 answer

Why can't I echo an acute accent in PHP?

echo '´'; just shows a question mark. I also tried with double quotes, but the same thing happens. I even tried adding a backslash in case it is an escaped character, but that just prints the backslash before the question mark. I have
CuppaJoe
  • 11
  • 4
1
vote
0 answers

Not able to enter backtick properly only on one site

I am unable to enter the backtick character properly on a site I contribute to. It makes the next character I type as accented. In other sites such as this I have no problem. I can easily type backticks to make text appear as code. I have a qwerty…
Utkarsh Barsaiyan
  • 335
  • 1
  • 2
  • 11