Quick Reference

Deploying Apps and Services with Droppanel makes use of the Bash scripting language. Bash can be used to script any server deployment and can even be used to write small programs. This quick reference shows the most common tasks for a shell script deployment on droppanel.

  1. Defining a Bash File
  2. Echoing A String
  3. Echoing A Multi Line String
  4. Saving a Multi-line String to a Variable
  5. Saving a Multi-line String to a File
  6. Multi Line Comments

Defining a Bash File

Creating a bash file starts with a comment that tells the terminal that this is a bash script. Here is a simple bash script which echos a string:

#!/bin/bash
echo "A bash script"

A bash script

Echoing Strings

Using the echo command is the primary means to output a single line of text to the terminal.

Echoing a string


#!/bin/bash
echo 'hello world!'

hello world

Echoing with Interpolation

When echoing with double quotes ", shell variables will be interpreted and expanded


#!/bin/bash
hello="jupiter"
echo "hello ${hello}!"

hello jupiter!

Echoing without Interpolation

When echoing with single quotes, the text as written will be output and variables will not be expanded


#!/bin/bash
hello='jupiter'
echo 'hello ${hello}!'

hello ${hello}!

Echo Multi-line String

Echo a multi line string using here docs and cat

#!/bin/bash
cat << mytext
this is a
multi-line
text block that will
be output using cat
mytext

this is a
multi-line
text block that will
be output using cat

Saving a Multi-line String To A Variable

Saving a multi line string using here docs and cat and setting it into a variable. This is useful when you may need to reference the string more than once.

#!/bin/bash
variable=$(cat << mytext
this is a
multi-line
text block that will
be output using cat
mytext
)

echo "$variable"


this is a
multi-line
text block that will
be output using cat

Saving a Multi-line String to a File

Redirects the multi line string to a particular file myfile.txt using here docs and cat

#!/bin/bash
cat > /myfile.txt << mytext
this is a
multi-line
text block that will
be output using cat
mytext

cat /myfile.txt


this is a
multi-line
text block that will
be output using cat

Multi Line Comments

Creating a multi-line comment using here docs. This is useful mostly when you want to temporarily comment out a block of code.

#!/bin/bash
: << comment
this is a
multi-line
text block that will
be commented out
comment