place posix shell warnings

This commit is contained in:
Malin Freeborn 2023-09-16 18:10:04 +02:00
parent aa34b8b6e8
commit 912eeb478b
Signed by: andonome
GPG Key ID: 52295D2377F4D70F
1 changed files with 19 additions and 2 deletions

View File

@ -1,6 +1,6 @@
---
title: "Terminal Tips"
tags: [ "Documentation", "System" ]
title: "bash tips"
tags: [ "Documentation", "Shell", "POSIX" ]
---
## Track Live Changes
@ -67,6 +67,18 @@ Add number to variables with:
`((n--))` works identically.
### POSIX WARNING
The number commands above work in `bash`, but not in bare-ass POSIX shells, such as `dash`.
Instead, you might do:
```sh
x=2
x=$(( x +1 ))
x=$(( x*x ))
```
## Finding Duplicate Files
```bash
@ -97,3 +109,8 @@ That gives you a random directory to mess about in.
cd $dir
```
### POSIX WARNING
These smart-brackets are a bash feature.
If you try to use `{A..Z}` in dash, it will think of this as a single item.