0

Writing a web2py on Cloud SQL boon using Gitbookl. It contains the following line of OSX bash shell code:

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

Would like to shorten the display to 40-60 characters per line while still allowing the user to copy and paste the code in. All of my experiments are failing, but obviously I want to do something like this:

$ ruby -e "$(curl -fsSL\
https://raw.githubusercontent.com/\
Homebrew/install/master/uninstall)"

No longer a Ruby guy and am at wit's end. Can someone tell me how to get a copy/pasteable line like this into my markdown?

(The general problem is that ebooks are limited to 40-60 columns in code printouts, and I need a way to handle long paths and long paths.)

2
  • 1
    Aren't you just missing the whitespace? e.g. ` -fsSL \ `. Otherwise it all gets munged together as one long run-on argument. Jan 5 '16 at 23:18
  • THAT'S IT! I love you and want to have your babies! Thank you so much, steeldriver!
    – tomcam
    Jan 6 '16 at 0:18
1

You can also do:

$ curl -fsSL https://raw.githubusercontent.com/\
Homebrew/install/master/uninstall|ruby
1
  • Nice! Was trying to avoid curl though because it's not built into OS X. Thank you.
    – tomcam
    Jan 6 '16 at 2:59
1

Something like this should to the trick..

domain="raw.githubusercontent.com"
url="Homebrew/install/master/uninstall"

ruby -e "$(curl -fsSL https://${domain}/${url})"
2
  • Worked like a charm. So sorry for the tardy reply, DopeGhoti!
    – tomcam
    Aug 6 '19 at 22:28
  • Pleased to have been able to help!
    – DopeGhoti
    Sep 18 '19 at 1:38
1

steeldriver nailed it. The answer was to insert a space before the slash at the end of the first line, so:

ruby -e "$(curl -fsSL \
https://raw.githubusercontent.com/\
Homebrew/install/master/uninstall)"

That can indeed be copy and pasted right into the shell prompt.

As soon as the Nobel committee sees fit to make me one of their own I am going to nominate steeldriver for something.

1
  • 1
    Specifically, "Since the escaped <newline> is removed entirely from the input and is not replaced by any white space, it cannot serve as a token separator.": see 2.2.1 Escape Character (Backslash) Jan 6 '16 at 0:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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