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

How do I use backticks to change directories?

I tried to change directories by using backticks in Ruby. I am on Ubuntu 12.04 box and this is the error I get: irb(main):003:0> `cd /` (irb):3: command not found: cd / => "" I run the command directly via the terminal and I change directories just…
Shail Patel
  • 1,764
  • 5
  • 30
  • 46
1
vote
2 answers

Split paragraphs with extra whitespace between them using Perl's paragraph mode

I'm trying to parse the output of pvdisplay(8), which prints a separate "paragraph" for each physical volume: --- Physical volume --- PV Name /dev/sdb VG Name vg_virtual_01 PV Size 16.37 TiB / not…
ThisSuitIsBlackNot
  • 23,492
  • 9
  • 63
  • 110
1
vote
1 answer

Why sshfs does not work with backtick?

When I do the following: `sshfs my@host.com /tmp/dir1/` in a irb console, the console freezes. If I use something like system("sshfs my@host.com /tmp/dir1/") it works, but I need to use backticks because the system call is in a method used many…
robertokl
  • 1,869
  • 2
  • 18
  • 28
1
vote
1 answer

Permission Denied - External Program Call Using Shoes With Ruby

Here is my code, I'm trying to simply open Adobe Acrobat Reader. When I use this code, or /Applications/Adobe Reader.app, the console tells me that "permission denied". Any ideas on how to get around this? Shoes.app :width => 200, :height => 200…
Travis May
  • 25
  • 4
1
vote
1 answer

.netrc, .fetchmailrc, and non-hardcoded passwords

Is there any way .netrc or .fetchmailrc can fetch passwords from environment variables, or fetch them from a spawned/forked shell? mutt can do it with something like this: set my_pw_gmail=`some shell command that emits to stdout` Is there any…
RoUS
  • 1,888
  • 2
  • 14
  • 29
1
vote
2 answers

Codeigniter Complex MySQL Query - Removing Backticks - is it a Security Issue?

I'm trying to build a MySQL query to return appropriate search results, by examining several different database fields. For example if a user searches "plumber leeds", if a business had 'leeds' in the 'city' field and the word 'plumber' as part of…
whispersan
  • 1,029
  • 2
  • 13
  • 28
1
vote
1 answer

Backticks returns filename with spaces and surrounding command fails

I am trying to do something like "copy the newest file in a directory." I have come up the following command simple command using backticks, which works fine for filenames without embedded white space: cp -rp `ls -1d searchstring | head -1`…
Jeffrey Simon
  • 918
  • 3
  • 11
  • 25
1
vote
2 answers

What does the backtick - ` - do in a command line invocation specifically with regards to Git commands?

I'm not a "command line" person by any means. I have been a front-end dev my entire career with little to no interaction with the command line, instead utilizing application GUIs as much as possible, so this may be a rather rudimentary question to…
natlee75
  • 5,097
  • 3
  • 34
  • 39
0
votes
2 answers

What does $? mean in Ruby?

I just read the comparison of PHP, Perl, Ruby and Python http://hyperpolyglot.org/scripting and saw the following code sample. files = `ls -l /tmp` unless $?.success? raise "ls failed" end files = %x(ls) unless $?.success? raise "ls…
Jeremy S.
  • 6,423
  • 13
  • 48
  • 67
0
votes
1 answer

processing filelist produced by grep but names have spaces

I am trying to use the output of a grep command to make replacements in all files found. The problem is that some of the files found have spaces in their names. Here is a grep command simplified from the one I'm using (which finds multiple names at…
0
votes
1 answer

Backticks in Bash script doesn't interpret curl parameter while command execution

I am executing the below command inside the shell script: CURL_RESPONSE=`curl --request POST "$1" --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'grant_type="$4"' --data-urlencode 'scope=operator test' --data-urlencode…
0
votes
1 answer

CodeBlock in TextView

I am currently developing an Android app and I would like to incorporate a feature that allows users to input code snippets in a similar fashion to how it's done on Stack Overflow. Specifically, I would like to enable users to separate code from…
0
votes
0 answers

Using addcslashes on string to escape backtick

If i have the following string, i try to escape the backticks before passing to node vm.script(...) for execution // test has been previously declared $someStr = "test = `more/${test}`"; $escapedSomeStr = sprintf('%s', addcslashes($someStr,…
robbyc73
  • 23
  • 1
  • 7
0
votes
1 answer

Has anyone ever discussed adding unquote syntax to PostgreSQL dollar-quoted strings?

Remember in LISP macros you could have those back-quotes to place evaluated expressions into larger string constants? Likewise, javascript has the `backtick quoting where you can place ${2 * 5} expressions` in which get evaluated to form the final…
Gunther Schadow
  • 1,490
  • 13
  • 22
0
votes
0 answers

Single quote ( ' ) vs double quote ( " ) in SQL or SQL in Google Cloud

When I write SQL queries, I sometimes get error messages and am not sure if it's because I am not using a backtick, or single quote, or double-quotation marks. I just keep trying different quotation marks until it works. Sometimes it doesn't require…