57 lines
1.1 KiB
Markdown
57 lines
1.1 KiB
Markdown
---
|
|
title: args
|
|
section: 1
|
|
author: Kevin Samuel <developer@kevinnlsamuel.com>
|
|
---
|
|
|
|
# SYNOPSIS
|
|
|
|
args ARGUMENT ...
|
|
|
|
# DESCRIPTION
|
|
|
|
**args** separately prints to standard output each argument it receives with its position.
|
|
|
|
The intended use of this tool is to help understand word splitting and quote removal by the shell.
|
|
|
|
Each argument prints one line of output in the following format.
|
|
|
|
```
|
|
@[POSITION] [ARGUMENT]
|
|
```
|
|
|
|
The two fields are separated by a single tab character.
|
|
|
|
In case an empty string is received as an argument, it is represented as follows
|
|
for clarity. These quotes are not the actual input. Quotes would normally be removed by
|
|
the shell before the command's execution.
|
|
|
|
```
|
|
@1 ''
|
|
```
|
|
|
|
# EXAMPLE
|
|
|
|
```console
|
|
$ args one two "" "word with spaces" $(echo substituted command)
|
|
@1 one
|
|
@2 two
|
|
@3 ''
|
|
@4 word with spaces
|
|
@5 substituted
|
|
@6 command
|
|
```
|
|
|
|
If @5 and @6 surprised you, finding cases like these and playing around is the exact
|
|
reason this tool exists.
|
|
|
|
# EXIT CODES
|
|
|
|
0 Success
|
|
|
|
1 Failed because no arguments were received
|
|
|
|
# LICENSE
|
|
|
|
This software is distributed under the license specified in `LICENSE.txt`
|