My Linux Learning Path
Do Linux to learn Linux. Create a directory in Desktop for this purpose.
- Use Bash exit parameter to assert the following condition test:
- 3 >= 6
- 2 = 7
- 56 <= 12
- (10^3) = 1000
- Create a script that accept two parameters (only) and use if .. then to assert previous relations (one script for relation). Script output must be 0 and 1 (true or false).
- In the previous exercises when script file is created, permission does not allow execution. Before changing permission use if .. then control flow to assert if file is: readable, executable and writable.
- Write a script that request two numbers: num1, num2. Next identify if:
- num1 = num2
- num1 > num2
- num1 < num2
- write a script that request a number: num1. Next identify if:
- num is positive and greater than 10.
- num is positive and greater than 20.
- num is negative and greater than -10.
- num is negative and greater than -20.
- num belongs to range [-10,7].
- num belongs to range [-10,7).
- num belongs to range (-10,7].
- num belongs to range (-10,7).
- Identify the meaning of the following file test operators. Write an example of each in the console. Next Write a script that accept one (only) input parameter and identify how to use each operator:
- -e ________________________.
- -f ________________________.
- -d ________________________.
- -s ________________________.
- -w ________________________.
- -r ________________________.
- -p ________________________.
- Identify how to mix previous file operators. For example test if xxxx.sh is executable and empty.
- Match Integer comparison operator
- -eq           !=
- -ne           <
- -gt           >=
- -lt           <=
- -ge           >
- -le           =
- Provide 3 examples of Nested if .. then condition test.
- Create a nested if then condition test considering. For this purpose create a script that request a number and test:
- Number is positive or negative.
- Number belongs to range [1,10] or [-1,-10].
- Number * 3 belongs to range [10,20] or [-15,-40].
No comments:
Post a Comment