mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
[bash/en] Update bash.html.markdown (#4202)
Additional info on arguments and return values for functions
This commit is contained in:
parent
68f016d886
commit
4eaafe0839
@ -17,6 +17,7 @@ contributors:
|
||||
- ["John Detter", "https://github.com/jdetter"]
|
||||
- ["Harry Mumford-Turner", "https://github.com/harrymt"]
|
||||
- ["Martin Nicholson", "https://github.com/mn113"]
|
||||
- ["Mark Grimwood", "https://github.com/MarkGrimwood"]
|
||||
filename: LearnBash.sh
|
||||
translators:
|
||||
- ["Dimitri Kokkonis", "https://github.com/kokkonisd"]
|
||||
@ -402,13 +403,17 @@ function foo ()
|
||||
echo "Arguments work just like script arguments: $@"
|
||||
echo "And: $1 $2..."
|
||||
echo "This is a function"
|
||||
return 0
|
||||
returnValue=0 # Variable values can be returned
|
||||
return $returnValue
|
||||
}
|
||||
# Call the function `foo` with two arguments, arg1 and arg2:
|
||||
foo arg1 arg2
|
||||
# => Arguments work just like script arguments: arg1 arg2
|
||||
# => And: arg1 arg2...
|
||||
# => This is a function
|
||||
# Return values can be obtained with $?
|
||||
resultValue=$?
|
||||
# More than 9 arguments are also possible by using braces, e.g. ${10}, ${11}, ...
|
||||
|
||||
# or simply
|
||||
bar ()
|
||||
|
Loading…
Reference in New Issue
Block a user