1

I don't understand how to properly format this particular thing (in block characters)


Just to fool around with script making, I made one that (I believe?) should open a terminal at startup:

#!/bin/bash #start terminal at startup #/usr/bin/gnome-terminal


The bit with the # (hash, pound or octothorpe symbol) causes the three lines to conform to one line, after I indented properly for block characters.

Without indents, I get this:


!/bin/bash

start terminal at startup

/usr/bin/gnome-terminal


How would I use block characters in the presence of the hash or pound sign?

1
  • What do you mean by "block characters"? Commented Sep 7, 2016 at 0:55

2 Answers 2

2

The standard answer is to create a "code block" by indenting every line by four spaces:

#!/bin/bash
#start terminal at startup
#/usr/bin/gnome-terminal

There are several ways to do this:

  • Manually type four spaces in front of every line.
  • Select your code, and then either
    • type Ctrl+K, or
    • click on the {} button above the edit window.

You can also get partial lines in code mode by surrounding them with backticks (`...`); e.g.,

#!/bin/bash

Or, to start a line with # without going into gray monospace mode, just type a backslash (\) before it:

#start terminal at startup

Incidentally, this applies to

  • Starting a line with - when the previous line is not blank.
  • Starting a line with something or something when the previous line is blank.
  • Starting a line with ---, ___ or *** when the previous line is blank.
  • Using pairs of * or _ characters as themselves: **this text is not bold**.
1
  • 1
    I realize that this answer overlaps with Adam's, but I submit that mine is more coherent and complete. Commented Sep 7, 2016 at 0:51
6

Code blocks are the way to go here:

Just to fool around with script making, I made one that (I believe?) should open a terminal at startup:

#!/bin/bash #start terminal at startup #/usr/bin/gnome-terminal 

You could also escape the # with a backslash:

#!bin/bash

See formatting help for more info.

4
  • I recommend using code formatting so that you can find the symbols by searching.
    – Laurel
    Commented Sep 7, 2016 at 0:22
  • I'm sure you understand this stuff — so, when the OP asks how to present a three-line script, why do you demonstrate how to do it all on one line? Commented Sep 7, 2016 at 0:53
  • @PeregrineRook I just copy-pasted what they had since it's still a representative example of formatting.
    – Adam Lear StaffMod
    Commented Sep 7, 2016 at 1:06
  • the backlash worked but it stays... Commented Sep 7, 2016 at 18:05

Not the answer you're looking for? Browse other questions tagged .