mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
add another way to define functions to bash (fix #380)
This commit is contained in:
parent
c149c619da
commit
3bfc820721
@ -117,7 +117,7 @@ done
|
|||||||
|
|
||||||
# You can also define functions
|
# You can also define functions
|
||||||
# Definition:
|
# Definition:
|
||||||
foo ()
|
function foo ()
|
||||||
{
|
{
|
||||||
echo "Arguments work just like script arguments: $@"
|
echo "Arguments work just like script arguments: $@"
|
||||||
echo "And: $1 $2..."
|
echo "And: $1 $2..."
|
||||||
@ -125,6 +125,13 @@ foo ()
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# or simply
|
||||||
|
bar ()
|
||||||
|
{
|
||||||
|
echo "Another way to declare functions!"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
# Calling your function
|
# Calling your function
|
||||||
foo "My name is" $NAME
|
foo "My name is" $NAME
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user