https://github.com/tatsuyafujisaki/script-cheat-sheet
Cheat sheets for various commands and scripts
https://github.com/tatsuyafujisaki/script-cheat-sheet
apt awk base64 bash batch binary curl cut ffmpeg gradle imagemagick npm pip powershell protoc sed sips xcodeproj zsh
Last synced: about 1 month ago
JSON representation
Cheat sheets for various commands and scripts
- Host: GitHub
- URL: https://github.com/tatsuyafujisaki/script-cheat-sheet
- Owner: tatsuyafujisaki
- Created: 2017-12-31T00:39:01.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2025-03-04T04:15:05.000Z (12 months ago)
- Last Synced: 2025-03-24T00:55:35.973Z (11 months ago)
- Topics: apt, awk, base64, bash, batch, binary, curl, cut, ffmpeg, gradle, imagemagick, npm, pip, powershell, protoc, sed, sips, xcodeproj, zsh
- Language: Batchfile
- Homepage:
- Size: 396 KB
- Stars: 7
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# How to denote required and optional arguments on the command line
* ``
* `[optional_argument]`
> Option-arguments are shown separated from their options by characters, except when the option-argument is enclosed in the '[' and ']' notation to indicate that it is optional.
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap12.html
# Note
Zsh does not expand the tilde (~) in single or double quotes.
> initial tildes and equals signs are not expanded
http://zsh.sourceforge.net/Guide/zshguide05.html
# Best practices
## What is the recommended way to temporarily switch to a different directory?
- Using a parenthesized command aka subshell
- e.g. `(cd && ls)`
- Using `cd ` and `cd -`
- Using `pushd ` and `popd`
Decision tree
1. If your command can be written as a one-liner, use a subshell..
1. If you switch to several different directories in a row, use `pushd ` and `popd`.
1. Otherwise, use `cd ` and `cd -`.