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.

Here is an example code from a book I need to type on terminal

> db.users.update( {username: "smith"},
{ $set: {favorites:
   {
     cities: ["Chicago", "Cheyenne"],
     movies: ["Casablanca", "The Sting"]
} }
})

How to write this? as soon as I write first line ending with comma (,) and press enter to goto next line it executes the command. Can I format my command like the above?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You can usually escape line breaks using a \. So just type that before you press enter. It probably depends on the program (e.g. shell) you're running though. In bash you get a continuation prompt (>) and can continue typing your command.

$ l\
> s -la
total 88
drwx------+  4 danielbeck  staff    136 10 Jan 08:13 .
drwxr-xr-x  67 danielbeck  staff   2278  9 Jan 23:37 ..
-rw-------@  1 danielbeck  staff  43012 10 Jan 08:13 .DS_Store

In many cases, you can skip newlines when typing in code from a book or other source. Your code snippet looks like it might work without newlines, and is just formatted like that for readability.

share|improve this answer
1  
The sql code syntax looks fine. It should be acepted on sql server prompt. End it with a semicolon. What error message are you getting? –  daya Jan 10 '12 at 7:36

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.