update shell
This commit is contained in:
parent
50ed173d7d
commit
a9a5c022bd
1 changed files with 10 additions and 1 deletions
|
@ -51,7 +51,7 @@ rm -v *.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
## Redirections
|
## Redirections
|
||||||
### 1. **Standard Input, Output, and Error**
|
### **Standard Input, Output, and Error**
|
||||||
In a shell environment, there are three standard streams:
|
In a shell environment, there are three standard streams:
|
||||||
- **Standard Input (stdin - fd 0):** Represents the input to a command.
|
- **Standard Input (stdin - fd 0):** Represents the input to a command.
|
||||||
- **Standard Output (stdout - fd 1):** Represents the output of a command.
|
- **Standard Output (stdout - fd 1):** Represents the output of a command.
|
||||||
|
@ -182,6 +182,15 @@ ${fruits[*]}
|
||||||
${fruits[@]}
|
${fruits[@]}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Use variable or `default` if the variable does not exist:
|
||||||
|
```shell
|
||||||
|
VR1=Value
|
||||||
|
MYVAR=${VR1:-default} # $MYVAR is 'Value'
|
||||||
|
|
||||||
|
#VR2=Value
|
||||||
|
MYVAR=${VR2:-default} # $MYVAR is 'default'
|
||||||
|
```
|
||||||
|
|
||||||
### Conditionals
|
### Conditionals
|
||||||
You can use conditional statements.
|
You can use conditional statements.
|
||||||
```shell
|
```shell
|
||||||
|
|
Loading…
Reference in a new issue