Page 1 of 1

the added the pages that the ques ask for to follow that pages

Posted: Mon May 02, 2022 12:04 pm
by answerhappygod
the added the pages that the ques ask for to follow that pages
The Added The Pages That The Ques Ask For To Follow That Pages 1
The Added The Pages That The Ques Ask For To Follow That Pages 1 (37.58 KiB) Viewed 50 times
The Added The Pages That The Ques Ask For To Follow That Pages 2
The Added The Pages That The Ques Ask For To Follow That Pages 2 (37.58 KiB) Viewed 50 times
The Added The Pages That The Ques Ask For To Follow That Pages 3
The Added The Pages That The Ques Ask For To Follow That Pages 3 (47.58 KiB) Viewed 50 times
The Added The Pages That The Ques Ask For To Follow That Pages 4
The Added The Pages That The Ques Ask For To Follow That Pages 4 (48.11 KiB) Viewed 50 times
The Added The Pages That The Ques Ask For To Follow That Pages 5
The Added The Pages That The Ques Ask For To Follow That Pages 5 (41.91 KiB) Viewed 50 times
The Added The Pages That The Ques Ask For To Follow That Pages 6
The Added The Pages That The Ques Ask For To Follow That Pages 6 (53.33 KiB) Viewed 50 times
The Added The Pages That The Ques Ask For To Follow That Pages 7
The Added The Pages That The Ques Ask For To Follow That Pages 7 (47.25 KiB) Viewed 50 times
The Added The Pages That The Ques Ask For To Follow That Pages 8
The Added The Pages That The Ques Ask For To Follow That Pages 8 (32.95 KiB) Viewed 50 times
Name 1: Write and run the "If Then Else", ex: from page 3, Ex1 change the script to test for the digits 5, 6, and 7. 2: Write and run the "Case", ex: from page 5, Ex2 change the script to test for the digits 5,6, and 7. 3: Write and run the "Case", ex from page 8, Ex3 change the You in the script to your name. 4: Write and run the "While", ex: from page11, Ex4 change the script to add 2 numbers and test for -It 20. 5: Write and run the "Until", ex: from page 14, Ex5 change the script to add 2 numbers and test for-ge 20 6: Write and run the "Until If Then Else", ex: from page 20, Ex6 change the script to add an item 3 in the Case statement to display the command Is-a.
3 / 65 49% + 0 page 3 Example 1 You can construct this type of branch with multiple if statements. In the example below, we evaluate some input from the user: #!/bin/bash echo -n "Enter a number between 1 and 3 inclusive > read character if [ "$character" = "1" ]; then echo "You entered one." elif [ "$character" = "2" ]; then echo "You entered two." elif [ "$character" = "3" ]; then echo "You entered three." else echo "You did not enter a number between 1 and 3." fi =
5 / 65 - 49% + IO page 5 Example 2 Fortunately, the shell provides a more elegant solution to this problem. It provides a built-in command called case, which can be used to construct an equivalent program: #!/bin/bash echo -n "Enter a number between 1 and 3 inclusive > " read character case $character in 1 ) echo "You entered one." 2) echo "You entered two." 3) echo "You entered three." * ) echo "You did not enter a number between 1 and 3." esac
8 / 65 | - 49% + 10 page 8 case selectively executes statements if word matches a pattern. You can have any number of patterns and statements. Patterns can be literal text or wildcards. You can have multiple patterns separated by the "" character. Here is a more advanced example to show what I mean: #!/bin/bash echo -n "Type a digit or a letter > read character case $character in # Check for letters [[:lower:]] | [[: upper:]] ) echo "You typed the letter $character" [0-91) # Check for digits echo "You typed the digit Scharacter" # Check for anything else echo "You did not type a letter or a digit" esac Notice the special pattern "*". This pattern will match anything, so it is used to catch cases that did not match previous patterns. Inclusion of this pattern at the end is wise, as it can be used to detect invalid input.
11 / 65 | - 49% + 10 page 11 Here is a simple example of a program that counts from zero to nine: #!/bin/bash number=0 while [ "$number" -lt 10 ]; do echo "Number = $number" number=$((number + 1)) done On line 3, we create a variable called number and initialize its value to 0. Next, we start the while loop. As you can see, we have specified a command that tests the value of number. In our example, we test to see if number has a value less than 10. Notice the word do on line 4 and the word done on line 7. These enclose the block of code that will be repeated as long as the exit status remains zero.
14 / 65 - 49% + | page 14 Until The until command works exactly the same way, except the block of code is repeated as long as the specified command's exit status is false. In the example below, notice how the expression given to the test command has been changed from the while example to achieve the same result: #!/bin/bash number=0 until [ "$number" -ge 10 ]; do echo "Number = $number" number=$( (number + 1)) done
20 / 65 | - 49% + 10 page 20 #!/bin/bash press_enter() { echo -en "\nPress Enter to continue" read clear } selection= until [ "$selection" = "0" ]; do echo PROGRAM MENU 1 - display free disk space 2 - display free memory 0 - exit program echo -n "Enter selection: read selection echo case $selection in 1) df ; press_enter ;; 2 ) free; press_enter ;; 0 ) exit ;; * ) echo "Please enter 1, 2, or 0"; press_enter esac done