File tree Expand file tree Collapse file tree
linux-bash/functions/src/main/bash Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,31 +51,29 @@ function arg_ref_sum_outputs() {
5151
5252# Subsection 3.1
5353variable=" baeldung"
54- function variable_scope2(){
54+ function variable_scope2() {
5555 echo " Variable inside function variable_scope2: [$variable ]"
5656 local variable=" ipsum"
5757}
5858
59- function variable_scope(){
59+ function variable_scope() {
6060 local variable=" lorem"
6161 echo " Variable inside function variable_scope: [$variable ]"
6262 variable_scope2
6363}
6464
6565# Subsection 3.2
6666subshell_sum=0
67- function simple_subshell_sum()
68- (
69- subshell_sum=$(( $1 + $2 ))
70- echo " Value of sum in function with global variables: [$subshell_sum ]"
71- )
72-
73- function simple_subshell_ref_sum()
74- (
75- declare -n sum_ref=$3
76- sum_ref=$(( $1 + $2 ))
77- echo " Value of sum in function with ref arguments: [$sum_ref ]"
78- )
67+ function simple_subshell_sum() (
68+ subshell_sum=$(( $1 + $2 ))
69+ echo " Value of sum in function with global variables: [$subshell_sum ]"
70+ )
71+
72+ function simple_subshell_ref_sum() (
73+ declare -n sum_ref=$3
74+ sum_ref=$(( $1 + $2 ))
75+ echo " Value of sum in function with ref arguments: [$sum_ref ]"
76+ )
7977
8078# Subsection 3.3
8179function redirection_in() {
@@ -93,7 +91,7 @@ function redirection_in_ps() {
9391 done
9492} < <( ls -ll /)
9593
96- function redirection_out_ps(){
94+ function redirection_out_ps() {
9795 declare -a output=(" baeldung" " lorem" " ipsum" " caracg" )
9896 for element in " ${output[@]} "
9997 do
You can’t perform that action at this time.
0 commit comments