Skip to content

Commit e6741d9

Browse files
authored
readonly variable and the unset operation
1 parent 48a1cea commit e6741d9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

learningbash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,8 @@
115115
status=$(systemctl status ${service} | grep active)
116116
echo $status
117117
```
118+
- To declare a readonly variable: `readonly variable="hello"`.
119+
- `unset var1`: to unset the variable `var1`, the `var1` will no longer be used, as if it wasn't declared.
120+
- echo `$?`: to print the exit status of the last executed command.
121+
- `test 1 -eq 1`, followed by echo `$?`: will print 0.
122+
- `test 1 -eq 1` is same as `[ 1 eq 1 ]`, using two brackets, we are allowed to use more operators: `[[ 1 = 1 ]]`

0 commit comments

Comments
 (0)