Created
December 26, 2021 11:02
-
-
Save mtvbrianking/addf264518d7d76a2c681aa7b3457110 to your computer and use it in GitHub Desktop.
bash command stdin arguments options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash arguments options stdin flags | |
required | |
optional | |
./cmd arg1 agr2 --debug --output=test.txt | |
Args: | |
- arg1 | |
- arg2 | |
...args are ordered == because they are read by position | |
...the 1st arg may be passed as stdin then piped to the command | |
Options | |
- o|output | |
...options can be abbr|word | |
...options can be required or optional | |
Flags | |
- v|verbose | |
...flags are options that just need to exist, their values ain't used | |
Example | |
sign message -k="private.key" -o="secret.txt" | |
sign message -k="private.key" -o="secret.txt" -v | |
sign message --key="private.key" --output="secret.txt" --verbose | |
echo "message" | sign --key="private.key" --output="secret.txt" --verbose | |
echo "message" | sign --key="private.key" 1> secret.txt | |
echo "message" | sign --key="private.key" 1> secret.txt 2> signing.err.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment