Skip to content

Main #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Main #20

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
9 changes: 9 additions & 0 deletions redirection-and-pipelines/error.txt
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
ls: cannot access './dir': No such file or directory
total 24
-rw-rw-rw- 1 vscode root 53 Apr 14 07:47 error.txt
-rw-rw-rw- 1 vscode root 390 Apr 11 07:45 output2.txt
-rw-rw-rw- 1 vscode root 862 Apr 14 07:43 output.txt
-rw-rw-rw- 1 vscode root 677 Apr 11 07:45 paragrah.txt
-rw-rw-rw- 1 vscode root 415 Apr 11 07:45 part1.txt
-rw-rw-rw- 1 vscode root 262 Apr 11 07:45 part2.txt
-rw-rw-rw- 1 vscode root 0 Apr 14 07:43 part3.txt
-rw-rw-rw- 1 vscode root 0 Apr 14 07:43 part4.txt
25 changes: 18 additions & 7 deletions redirection-and-pipelines/output.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
total 8
-rw-rw-rw- 1 vscode vscode 0 Jan 17 18:03 error.txt
-rw-rw-rw- 1 vscode vscode 0 Jan 17 18:10 output.txt
-rw-rw-rw- 1 vscode vscode 415 Jan 17 17:37 part1.txt
-rw-rw-rw- 1 vscode vscode 262 Jan 17 17:37 part2.txt
-rw-rw-rw- 1 vscode vscode 0 Jan 17 17:54 part3.txt
-rw-rw-rw- 1 vscode vscode 0 Jan 17 17:56 part4.txt
total 20
-rw-rw-rw- 1 vscode root 53 Apr 11 07:45 error.txt
-rw-rw-rw- 1 vscode root 390 Apr 11 07:45 output2.txt
-rw-rw-rw- 1 vscode root 0 Apr 14 07:43 output.txt
-rw-rw-rw- 1 vscode root 677 Apr 11 07:45 paragrah.txt
-rw-rw-rw- 1 vscode root 415 Apr 11 07:45 part1.txt
-rw-rw-rw- 1 vscode root 262 Apr 11 07:45 part2.txt
-rw-rw-rw- 1 vscode root 0 Apr 14 07:43 part3.txt
-rw-rw-rw- 1 vscode root 0 Apr 11 09:42 part4.txt
total 24
-rw-rw-rw- 1 vscode root 53 Apr 11 07:45 error.txt
-rw-rw-rw- 1 vscode root 390 Apr 11 07:45 output2.txt
-rw-rw-rw- 1 vscode root 431 Apr 14 07:43 output.txt
-rw-rw-rw- 1 vscode root 677 Apr 11 07:45 paragrah.txt
-rw-rw-rw- 1 vscode root 415 Apr 11 07:45 part1.txt
-rw-rw-rw- 1 vscode root 262 Apr 11 07:45 part2.txt
-rw-rw-rw- 1 vscode root 0 Apr 14 07:43 part3.txt
-rw-rw-rw- 1 vscode root 0 Apr 14 07:43 part4.txt
17 changes: 9 additions & 8 deletions redirection-and-pipelines/output2.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
total 16
-rw-rw-rw- 1 vscode vscode 53 Jan 17 18:12 error.txt
-rw-rw-rw- 1 vscode vscode 0 Jan 17 18:15 output2.txt
-rw-rw-rw- 1 vscode vscode 333 Jan 17 18:10 output.txt
-rw-rw-rw- 1 vscode vscode 415 Jan 17 17:37 part1.txt
-rw-rw-rw- 1 vscode vscode 262 Jan 17 17:37 part2.txt
-rw-rw-rw- 1 vscode vscode 0 Jan 17 17:54 part3.txt
-rw-rw-rw- 1 vscode vscode 0 Jan 17 17:56 part4.txt
total 20
-rw-rw-rw- 1 vscode root 484 Apr 14 07:48 error.txt
-rw-rw-rw- 1 vscode root 0 Apr 14 07:49 output2.txt
-rw-rw-rw- 1 vscode root 862 Apr 14 07:43 output.txt
-rw-rw-rw- 1 vscode root 677 Apr 11 07:45 paragrah.txt
-rw-rw-rw- 1 vscode root 415 Apr 11 07:45 part1.txt
-rw-rw-rw- 1 vscode root 262 Apr 11 07:45 part2.txt
-rw-rw-rw- 1 vscode root 0 Apr 14 07:43 part3.txt
-rw-rw-rw- 1 vscode root 0 Apr 14 07:43 part4.txt
5 changes: 5 additions & 0 deletions redirection-and-pipelines/paragraph.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Mauris pharetra et ultrices neque ornare aenean euismod. Adipiscing enim eu turpis egestas pretium aenean pharetra magna ac. Nibh nisl condimentum id venenatis a condimentum. Interdum velit euismod in pellentesque massa placerat. Ac feugiat sed lectus vestibulum mattis ullamcorper velit.
Libero justo laoreet sit amet cursus sit amet dictum sit. Pharetra vel turpis nunc eget lorem dolor sed.
Ultrices neque ornare aenean euismod elementum nisi quis eleifend quam. Laoreet id donec ultrices tincidunt.
Pulvinar sapien et ligula ullamcorper malesuada.
17 changes: 9 additions & 8 deletions what-are-case-statements/case_statement
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

# A script that will ask for a number and print out a message depending on the value.

read -p "Enter a number: " n
read -p "Enter a value: " n

case $n in
???)
echo "One";;
2)
echo "Two";;
aa)
echo "Three";;
1|2)
echo "One or Two";;
[3-9])
echo "Number 3 through 9";;
??)
echo "Two Characters";;
*.txt)
echo "Four";;
echo "Ends in .txt";;
*)
echo "Other";;
esac
Expand Down
2 changes: 1 addition & 1 deletion what-are-conditional-statements/is_number_even
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

number=25
number=15

if [ $((number % 2)) -eq 0 ];
then
Expand Down
6 changes: 3 additions & 3 deletions what-are-functions/add_numbers
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

check_even () {
local mod=2
echo "The value of mod is $mod"
echo "The value of mod is $mod inside of function"
if [ $(("$1" % $mod)) -eq 0 ]
then
echo "The number $1 is even!";
Expand All @@ -12,7 +12,7 @@ check_even () {
}


number=2344
number=4563

check_even $number
echo $mod
echo "The value of $mod is outside of function: "
2 changes: 1 addition & 1 deletion what-are-loops/for_loop_new_c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

# A script to display a series of numbers using a for loop.

for (( i=0; i<5; i=i+1 )); do
for (( i=0; i<50; i=i+1 )); do
echo "The counter is at: $i"
done
Empty file modified what-are-loops/for_loop_traditional
100644 → 100755
Empty file.
Empty file modified what-are-loops/loop_and_break
100644 → 100755
Empty file.
Empty file modified what-are-loops/until_loop
100644 → 100755
Empty file.
Empty file modified what-are-loops/while_loop
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion what-is-a-bash-script/hello_world
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

# Welcome to your first Bash Script

echo 'Hello World!'
echo 'Hello World!'

8 changes: 7 additions & 1 deletion what-is-a-variable/hello_variable
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@

# Welcome to your first Bash Script

echo 'Hello World!'
hello_message='Hello, World!'
current_dir=$(pwd)
readonly variable_wont_change="blue"


variable_wont_change="red"
echo "$hello_message from $current_dir your favourite color is $variable_wont_change"