Olli Graf
2 months ago
7 changed files with 63 additions and 7 deletions
@ -1,13 +1,14 @@ |
|||
#! /usr/bin/bash |
|||
# File: mult-echo.sh |
|||
|
|||
echo "Hallo 1" |
|||
echo "Hallo 2" |
|||
echo "-------" |
|||
|
|||
echo "Hallo 1" |
|||
echo "Hallo 2" |
|||
echo "-------" |
|||
|
|||
echo "Hallo 1" |
|||
echo "Hallo 2" |
|||
echo "-------" |
|||
|
|||
echo "Hallo 1" |
|||
echo "Hallo 2" |
|||
echo "-------" |
|||
|
@ -0,0 +1,14 @@ |
|||
#! /usr/bin/bash |
|||
# File: return-value-echo.sh |
|||
|
|||
|
|||
function square() { |
|||
|
|||
echo $(( ${1} * ${1} )) |
|||
} |
|||
|
|||
|
|||
square "2" |
|||
square "4" |
|||
square "3" |
|||
square "32" |
@ -0,0 +1,20 @@ |
|||
#! /usr/bin/bash |
|||
# File: return-value-echo2.sh |
|||
|
|||
|
|||
function square() { |
|||
|
|||
echo $(( ${1} * ${1} )) |
|||
} |
|||
|
|||
|
|||
s2=$(square "2") |
|||
s4=$(square "4") |
|||
s3=$(square "3") |
|||
s32=$(square "32") |
|||
|
|||
|
|||
echo "Das Quadrat von 2 ist ${s2}" |
|||
echo "Das Quadrat von 4 ist ${s4}" |
|||
echo "Das Quadrat von 3 ist ${s3}" |
|||
echo "Das Quadrat von 32 ist ${s32}" |
@ -0,0 +1,18 @@ |
|||
#! /usr/bin/bash |
|||
# File: return-value-return.sh |
|||
|
|||
|
|||
function square() { |
|||
|
|||
return $(( ${1} * ${1} )) |
|||
} |
|||
|
|||
|
|||
square "2" |
|||
echo "Quadrat von 2 ist ${?}" |
|||
square "4" |
|||
echo "Quadrat von 4 ist ${?}" |
|||
square "3" |
|||
echo "Quadrat von 3 ist ${?}" |
|||
square "32" |
|||
echo "Quadrat von 32 ist ${?}" |
Loading…
Reference in new issue