diff --git a/Chapter01/Variable scope script1.sh b/Chapter01/Variable scope script1.sh index b0905e3..537f11f 100644 --- a/Chapter01/Variable scope script1.sh +++ b/Chapter01/Variable scope script1.sh @@ -2,4 +2,7 @@ #!/bin/bash name="Mokhtar" export name # The variable will be accessible to other processes -./06-script2.sh \ No newline at end of file +./06-script2.sh + +# second part, we updated name variable in script2.sh, let's what we see +echo $name # ouput: Mokhtar \ No newline at end of file diff --git a/Chapter01/script2.sh b/Chapter01/script2.sh index 66a3a77..fa7973a 100644 --- a/Chapter01/script2.sh +++ b/Chapter01/script2.sh @@ -1,3 +1,8 @@ # The script2.sh script #!/bin/bash -echo $name \ No newline at end of file +echo $name + +# second part + +name=shell # it updated the value of name variable but didn't update the original which comes from script1. +echo $name diff --git a/Chapter02/prompt.sh b/Chapter02/prompt.sh new file mode 100644 index 0000000..2531813 --- /dev/null +++ b/Chapter02/prompt.sh @@ -0,0 +1,5 @@ +#!/bin/bash +echo -n "Hello $(basename $0)! May I ask your name: " +read +echo "Hello $REPLY" +exit 0