document why i did this thing
This commit is contained in:
44
README.md
44
README.md
@@ -0,0 +1,44 @@
|
|||||||
|
# args
|
||||||
|
|
||||||
|
args is a simple command line tool that lists out each positional argument that it receives
|
||||||
|
|
||||||
|
|
||||||
|
## why?
|
||||||
|
|
||||||
|
i created it to help me understand word-splitting and quote removal in shells
|
||||||
|
|
||||||
|
## how do i use it?
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ args one two three
|
||||||
|
@1 one
|
||||||
|
@2 two
|
||||||
|
@3 three
|
||||||
|
|
||||||
|
$ # the second argument doesn't get split because of the quotes
|
||||||
|
$ args one 'a world of spaces'
|
||||||
|
@1 one
|
||||||
|
@2 a world with spaces
|
||||||
|
|
||||||
|
$ # NOTE: empty arguments are presented as ''
|
||||||
|
$ args ''
|
||||||
|
@1 ''
|
||||||
|
|
||||||
|
$ # words are split, quoting removed
|
||||||
|
$ args $(echo hello \"world\")
|
||||||
|
@1 hello
|
||||||
|
@2 "world"
|
||||||
|
|
||||||
|
$ # words aren't split because $() is quoted
|
||||||
|
$ args "$(echo hello \"world\")"
|
||||||
|
@1 hello "world"
|
||||||
|
```
|
||||||
|
## how do i install it?
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ cd [a reasonable place]
|
||||||
|
$ # |_ personally i create and use ~/.local/src
|
||||||
|
$ git clone https://gitea.kevinnlsamuel.com/kevinnlsamuel/args.git --depth 1
|
||||||
|
$ cd args
|
||||||
|
$ make build install
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user