checks for layout
This commit is contained in:
parent
6e67ad7570
commit
468810eb86
|
@ -73,7 +73,7 @@
|
|||
# Lesson 3.3.1
|
||||
|
||||
1. The user types the following to their shell:
|
||||
* ```
|
||||
```
|
||||
$ PATH=~/scripts
|
||||
$ ls
|
||||
Command 'ls' is available in '/bin/ls'
|
||||
|
@ -83,7 +83,7 @@
|
|||
* What has the user done?
|
||||
* 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:
|
||||
* ```
|
||||
```
|
||||
> /!bin/bash
|
||||
|
||||
> fruit1 = Apples
|
||||
|
@ -101,7 +101,7 @@
|
|||
```
|
||||
* The lines marked with a > contain errors. Fix the errors.
|
||||
1. What will the output be in the following situations?
|
||||
* ```
|
||||
```
|
||||
$ ./guided1.sh 3 0
|
||||
$ ./guided1.sh 2 4
|
||||
$ ./guided1.sh 0 1
|
||||
|
@ -110,7 +110,7 @@
|
|||
## 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):
|
||||
* ```
|
||||
```
|
||||
if [ $1 == $number ]
|
||||
then
|
||||
echo "True!"
|
||||
|
@ -125,7 +125,7 @@
|
|||
## Guided Exercises
|
||||
|
||||
1. Read the contents of script1.sh below:
|
||||
* ```
|
||||
```
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# -lt 1 ]
|
||||
|
@ -145,7 +145,7 @@
|
|||
exit 0
|
||||
```
|
||||
* What is the output of these commands?
|
||||
* ```
|
||||
```
|
||||
./script1.sh
|
||||
echo $?
|
||||
./script1.sh cake
|
||||
|
@ -155,7 +155,7 @@
|
|||
```
|
||||
|
||||
2. Read the contents of file script2.sh:
|
||||
* ```
|
||||
```
|
||||
for filename in $1/*.txt
|
||||
do
|
||||
cp $filename $filename.bak
|
||||
|
|
Loading…
Reference in New Issue