checks for layout

This commit is contained in:
waldek 2021-04-10 14:12:38 +02:00
parent 6e67ad7570
commit 468810eb86
1 changed files with 7 additions and 7 deletions

View File

@ -73,7 +73,7 @@
# Lesson 3.3.1 # Lesson 3.3.1
1. The user types the following to their shell: 1. The user types the following to their shell:
* ``` ```
$ PATH=~/scripts $ PATH=~/scripts
$ ls $ ls
Command 'ls' is available in '/bin/ls' Command 'ls' is available in '/bin/ls'
@ -83,7 +83,7 @@
* What has the user done? * What has the user done?
* What command will combine the current value of PATH with the new directory ~/scripts? * What command will combine the current value of PATH with the new directory ~/scripts?
1. Consider the following script. Notice that it is using elif to check for a second condition: 1. Consider the following script. Notice that it is using elif to check for a second condition:
* ``` ```
> /!bin/bash > /!bin/bash
> fruit1 = Apples > fruit1 = Apples
@ -101,7 +101,7 @@
``` ```
* The lines marked with a > contain errors. Fix the errors. * The lines marked with a > contain errors. Fix the errors.
1. What will the output be in the following situations? 1. What will the output be in the following situations?
* ``` ```
$ ./guided1.sh 3 0 $ ./guided1.sh 3 0
$ ./guided1.sh 2 4 $ ./guided1.sh 2 4
$ ./guided1.sh 0 1 $ ./guided1.sh 0 1
@ -110,7 +110,7 @@
## Explorational Exercises ## Explorational Exercises
1. Write a simple script that will check if exactly two arguments are passed. If so, print the arguments in reverse order. Consider this example (note: your code may look different than this, but should lead to the same output): 1. Write a simple script that will check if exactly two arguments are passed. If so, print the arguments in reverse order. Consider this example (note: your code may look different than this, but should lead to the same output):
* ``` ```
if [ $1 == $number ] if [ $1 == $number ]
then then
echo "True!" echo "True!"
@ -125,7 +125,7 @@
## Guided Exercises ## Guided Exercises
1. Read the contents of script1.sh below: 1. Read the contents of script1.sh below:
* ``` ```
#!/bin/bash #!/bin/bash
if [ $# -lt 1 ] if [ $# -lt 1 ]
@ -145,7 +145,7 @@
exit 0 exit 0
``` ```
* What is the output of these commands? * What is the output of these commands?
* ``` ```
./script1.sh ./script1.sh
echo $? echo $?
./script1.sh cake ./script1.sh cake
@ -155,7 +155,7 @@
``` ```
2. Read the contents of file script2.sh: 2. Read the contents of file script2.sh:
* ``` ```
for filename in $1/*.txt for filename in $1/*.txt
do do
cp $filename $filename.bak cp $filename $filename.bak