Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Chapter01/Variable scope script1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
#!/bin/bash
name="Mokhtar"
export name # The variable will be accessible to other processes
./06-script2.sh
./06-script2.sh

# second part, we updated name variable in script2.sh, let's what we see
echo $name # ouput: Mokhtar
7 changes: 6 additions & 1 deletion Chapter01/script2.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# The script2.sh script
#!/bin/bash
echo $name
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
5 changes: 5 additions & 0 deletions Chapter02/prompt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
echo -n "Hello $(basename $0)! May I ask your name: "
read
echo "Hello $REPLY"
exit 0