mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +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
|
||||
# Definition:
|
||||
foo ()
|
||||
function foo ()
|
||||
{
|
||||
echo "Arguments work just like script arguments: $@"
|
||||
echo "And: $1 $2..."
|
||||
@ -125,6 +125,13 @@ foo ()
|
||||
return 0
|
||||
}
|
||||
|
||||
# or simply
|
||||
bar ()
|
||||
{
|
||||
echo "Another way to declare functions!"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Calling your function
|
||||
foo "My name is" $NAME
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user