Skip to content

Commit

Permalink
Update bash.md
Browse files Browse the repository at this point in the history
  • Loading branch information
JV-conseil committed Jan 27, 2024
1 parent 206d7cd commit c54d58e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions bash.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,25 @@ https://github.com/JV-conseil/docs

## Padding characters with printf

```bash
for i in $(seq -f "%04g" 1 470)
do
echo $i
done
```

will output

```bash
0001
0002
...
0469
0470
```

_src 👉 [How to zero pad a sequence of integers in bash so that all have the same width](https://stackoverflow.com/a/8789815/2477854)_

`printf '%0.1s' "."{0..10}` will output `...........`

_src 👉 [Padding characters in printf](https://stackoverflow.com/a/4410103/2477854) and [printf syntax](https://www.warp.dev/terminus/bash-printf)_
Expand Down

0 comments on commit c54d58e

Please sign in to comment.