diff --git a/redirection-and-pipelines/error.txt b/redirection-and-pipelines/error.txt index 4f77620..e309180 100644 --- a/redirection-and-pipelines/error.txt +++ b/redirection-and-pipelines/error.txt @@ -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 diff --git a/redirection-and-pipelines/output.txt b/redirection-and-pipelines/output.txt index ccf1b18..a9ba202 100644 --- a/redirection-and-pipelines/output.txt +++ b/redirection-and-pipelines/output.txt @@ -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 diff --git a/redirection-and-pipelines/output2.txt b/redirection-and-pipelines/output2.txt index 5572745..644a272 100644 --- a/redirection-and-pipelines/output2.txt +++ b/redirection-and-pipelines/output2.txt @@ -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 diff --git a/redirection-and-pipelines/paragraph.txt b/redirection-and-pipelines/paragraph.txt new file mode 100644 index 0000000..a912842 --- /dev/null +++ b/redirection-and-pipelines/paragraph.txt @@ -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. \ No newline at end of file diff --git a/what-are-case-statements/case_statement b/what-are-case-statements/case_statement old mode 100644 new mode 100755 index 842838b..819b244 --- a/what-are-case-statements/case_statement +++ b/what-are-case-statements/case_statement @@ -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 diff --git a/what-are-conditional-statements/is_number_even b/what-are-conditional-statements/is_number_even old mode 100644 new mode 100755 index e215ab3..abff849 --- a/what-are-conditional-statements/is_number_even +++ b/what-are-conditional-statements/is_number_even @@ -1,6 +1,6 @@ #!/bin/bash -number=25 +number=15 if [ $((number % 2)) -eq 0 ]; then diff --git a/what-are-functions/add_numbers b/what-are-functions/add_numbers old mode 100644 new mode 100755 index 050d20f..9353ccb --- a/what-are-functions/add_numbers +++ b/what-are-functions/add_numbers @@ -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!"; @@ -12,7 +12,7 @@ check_even () { } -number=2344 +number=4563 check_even $number -echo $mod \ No newline at end of file +echo "The value of $mod is outside of function: " \ No newline at end of file diff --git a/what-are-loops/for_loop_new_c b/what-are-loops/for_loop_new_c old mode 100644 new mode 100755 index fc1ccc7..a7e5705 --- a/what-are-loops/for_loop_new_c +++ b/what-are-loops/for_loop_new_c @@ -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 \ No newline at end of file diff --git a/what-are-loops/for_loop_traditional b/what-are-loops/for_loop_traditional old mode 100644 new mode 100755 diff --git a/what-are-loops/loop_and_break b/what-are-loops/loop_and_break old mode 100644 new mode 100755 diff --git a/what-are-loops/until_loop b/what-are-loops/until_loop old mode 100644 new mode 100755 diff --git a/what-are-loops/while_loop b/what-are-loops/while_loop old mode 100644 new mode 100755 diff --git a/what-is-a-bash-script/hello_world b/what-is-a-bash-script/hello_world old mode 100644 new mode 100755 index 89ae6a1..c910663 --- a/what-is-a-bash-script/hello_world +++ b/what-is-a-bash-script/hello_world @@ -2,4 +2,5 @@ # Welcome to your first Bash Script -echo 'Hello World!' \ No newline at end of file +echo 'Hello World!' + diff --git a/what-is-a-variable/hello_variable b/what-is-a-variable/hello_variable old mode 100644 new mode 100755 index 89ae6a1..52a6628 --- a/what-is-a-variable/hello_variable +++ b/what-is-a-variable/hello_variable @@ -2,4 +2,10 @@ # Welcome to your first Bash Script -echo 'Hello World!' \ No newline at end of file +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" \ No newline at end of file