In this project, I began working loops and conditionals statemetns in Bash.
- apache-access.log: An Apache access log file parsed in
tasks
102
and103
.
-
0. Create a SSH RSA key pair
- 0-RSA_public_key.pub: A public SSH key uploaded for the purposes of Holberton School.
-
1. For loop
- 1-for_holberton_school: Bash script that displays
Holberton School
10 times using afor
loop.
- 1-for_holberton_school: Bash script that displays
-
2. While loop
- 2-while_holberton_school: Bash script that
displays
Holberton School
10 times using awhile
loop.
- 2-while_holberton_school: Bash script that
displays
-
3. Until Holberton School loop
- 3-until_holberton_school: Bash script that displays
Holberton School
10 times using anuntil
loop.
- 3-until_holberton_school: Bash script that displays
-
4. If 9, say Hi!
- 4-if_9_say_hi: Bash script that displays
Holberton School
10 times using awhile
loop. - For the 9th iteration, displays
Holberton School
and thenHi
on a new line. - Uses an
if
statement.
- 4-if_9_say_hi: Bash script that displays
-
5. 4 bad luck, 8 is your chance
- 5-4_bad_luck_8_is_your_chance: Bash script that loops
from 1 to 10 using a
while
loop and:- Displays
bad luck
on the 4th iteration. - Displays
good luck
on the 8th iteration. - Displays
Holberton School
for all other iterations.
- Displays
- Uses the
if
,elif
, andelse
statements.
- 5-4_bad_luck_8_is_your_chance: Bash script that loops
from 1 to 10 using a
-
6. Superstitious numbers
- 6-superstitious_numbers: Bash script that displays
numbers from
1
to20
using awhile
loop and:- Displays
4
and thenbad luck from China
for the 4th iteration. - Displays
9
and thenbad luck from Japan
for the 9th iteration. - Displays
17
and thenbad luck from Italy
for the 17th iteration.
- Displays
- Uses a
case
statement.
- 6-superstitious_numbers: Bash script that displays
numbers from
-
7. Clock
- 7-clock: Bash script that displays the time for 12 hours and 59 minutes.
- Displays hours from
0
to12
. - Displays minutes from
0
to59
.
- Displays hours from
- 7-clock: Bash script that displays the time for 12 hours and 59 minutes.
-
8. For ls
- 8-for_ls: Bash script that displays the contents of the current directory in list format.
- Only the part of the name after the first dash is displayed.
-
9. To file, or not to file
- 9-to_file_or_not_to_file: Bash script that gives information
about the
holbertonschool
file.- If the file exists, displays:
holbertonschool file exists
. - If the file does not exist, displays:
holbertonschool file does not exist
. - If the file exists and is empty, displays:
holbertonschool file is empty
. - If the file exists and is not empty, displays:
holbertonschoolfile is not empty
. - If the file exists and is a regular file, displays:
holbertonschool file is a regular file
. - Otherwise, displays nothing.
- If the file exists, displays:
- 9-to_file_or_not_to_file: Bash script that gives information
about the
-
10. FizzBuzz
- 10-fizzbuzz: Bash script that displays numbers from
1
to100
in list format. - Displays
FizzBuzz
when the number is a multiple of 3 and 5. - Displays
Fizz
when the number is a multiple of 3. - Displays
Buzz
when the number is a multiple of 5. - Otherwise, displays the number.
- 10-fizzbuzz: Bash script that displays numbers from
-
11. Read and cut
- 100-read_and_cut: Bash script that displays the contents of the
/etc/passwd
file. - Displays only the username, user id, and user home directory path for each line.
- 100-read_and_cut: Bash script that displays the contents of the
-
12. Tell the story of passwd
- 101-tell_the_story_of_passwd: Bash script that
tells stories based on the contents of the
/etc/passwd
file. - Displays content from the file in the format:
The user USERNAME is part of the GROUP_ID gang, lives in HOME_DIRECTORY and rides COMMAND/SHELL. USER ID's place is protected by the passcode PASSWORD, more info about the user here: USER ID INFO
.
- 101-tell_the_story_of_passwd: Bash script that
tells stories based on the contents of the
-
13. Let's parse Apache logs
- 102-lets_parse_apache_logs: Bash script that displays the visitor IP along with the HTTP status code for logs read from an Apache log access file.
- Displays content in the format
IP HTTP_CODE
. - Uses
awk
.
-
14. Dig the data
- 103-dig_the-data: Bash script that reads content from an Apace log access file and groups visitors by IP and HTTP status code.
- Displays the grouped number of visitors to an IP address in the format
OCCURRENCE_NUMBER IP HTTP_CODE
. - Logs are grouped in order of greatest to lowest number of visitors.
- Uses
awk
.