CSC231 Bash Tutorial 8

From dftwiki3
Revision as of 13:13, 1 November 2017 by Thiebaut (talk | contribs) (Created page with "--~~~~ ---- =Bash Functions= <br /> There are two ways of declaring functions in bash, illustrated in the code below: <br /> ::<source lang="bash"> #! /bin/bash # func1.sh # ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

--D. Thiebaut (talk) 13:13, 1 November 2017 (EDT)


Bash Functions


There are two ways of declaring functions in bash, illustrated in the code below:

#! /bin/bash
# func1.sh
# D. Thiebaut
# prints some messages

printSomething() {
    echo "Hello there!"
}

function printSomethingElse {
    echo "Hello again!"
}

printSomething
printSomething
printSomethingElse