forked from logicopslab/BashScripting
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
logicopslab
committed
Dec 29, 2021
1 parent
1f5f66b
commit 3dccb74
Showing
5 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
ls /no/such/folder | ||
echo "$?" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
HOST="www.google.com" | ||
ping -c 2 $HOST | ||
|
||
if [ "$?" -eq "0" ] | ||
then | ||
echo "The Host $HOST is reachable." | ||
else | ||
echo "The Host $HOST is NOT reachable." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
HOST="www.google.com" | ||
ping -c 2 $HOST | ||
|
||
RETURN_CODE=$? | ||
|
||
# Here RETURN_CODE contains the | ||
# exit status | ||
|
||
if [ "$RETURN_CODE" != "0" ] | ||
then | ||
echo "The Host $HOST is NOT reachable." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
ping -c 1 -w 2 google.com | ||
echo $? | ||
|
||
ping -c 1 -w 2 anything.microsoft.com | ||
echo $? | ||
|
||
# man ping | ||
# N | ||
# /code | ||
# q |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
# Using && | ||
|
||
mkdir LogicOpsLab && cp -v 04.RC_Wait.sh LogicOpsLab/04.RC_Wait.sh | ||
|
||
# -v is for verbose | ||
# cp is copy | ||
|
||
echo $? | ||
|
||
# Using || | ||
|
||
cp -v 04.RC_Wait.sh LogicOpsLab/01.ExitStatus.sh || cp -v 04.RC_Wait.sh LogicOpsLabs/ExitStatus.sh | ||
echo $? |