Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In a (SSH) terminal session, what is the purpose of the mode started by the key sequence apostrophe <ENTER> or more literally '<ENTER>.

What is the way to exit that mode?

share|improve this question
    
You mean that you type ' then enter, and are wondering what's happening? –  Mat May 20 '12 at 9:27
    
Yes. I will edit to clarify. –  broiyan May 20 '12 at 9:38
    
There actually is a "special SSH command mode" that is started by default ~ followed by newline. See the "Escape characters" section in man ssh. I'm guessing this is not what you are seeing here, though. –  Daniel Andersson May 20 '12 at 12:33

1 Answer 1

up vote 5 down vote accepted

Typing 'enter doesn't start any special SSH mode. The (normal) commands you type are interpreted by the shell on the other end of your SSH connection, not SSH itself.

' is usually called a single quote in shell terminology, " a double-quote, and ` is a backtick.

' starts a character sequence that is not interpreted by the shell. This is useful, for example, if you need to pass and argument to a program the must contain $ or another character sequence the would otherwise be interpreted by the shell, or that contains newlines. You end that sequence with another '.

" is similar, but some interpolation happens (i.e. variables are expanded).

` is different. That's for command substitution. If you type

echo `foo`

the output of running the foo program is substituted before running the echo command. Another way of doing that is by using $(...):

echo $(foo)

So if you type 'enter, you're just starting a multiline literal string. You end that either with a matching ', or with CtrlC if you want to break out.

$ echo 'hello
> this
> is 
> a
> multiline
> string
> '
hello
this
is
a
multiline
string
$ echo 'foo $PWD'
foo $PWD               # no interpolation
$ echo "foo $PWD"
foo /tmp               # interpolation

Starting a line with a ' isn't really useful by itself.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.