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
19 changes: 16 additions & 3 deletions 06-infinite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,23 @@
# the if statement had, if-then-fi
# while loop has, while-do-done
# true and false are also Unix commands
while [ true ]; do
echo "infinite number of beer on the wall"
done
# while [ true ]; do
# echo "infinite number of beer on the wall"
# done

# exercise: write a script that continues to look up
# the ip address of a given hostname (using nslookup) until
# the user decides to stop

while true; do
echo "Enter a hostname to look up (or type 'exit' to quit):"
read hostname

if [ "$hostname" = "exit" ]; then
echo "Exiting script."
break
fi

nslookup "$hostname"
echo ""
done
Binary file added BRANCHES.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions gitassignment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
# read the name of the user and print hello

echo "Hello! Hugo!"