Results for “command substitution”
Small, practical examples. Search by task or narrow things down below.
Change directory only for one operation
Bash Scripts: A subshell makes a temporary directory change without affecting later commands.
Bash Scripts✓ Tested
Check a script’s syntax without executing its body
Bash Scripts: bash -n parses commands but does not run ordinary script statements.
Bash Scripts✓ Tested
Check available disk space
Show total, used, and available filesystem space for the current directory in human-readable units.
disk✓ Tested
Check memory usage
Show memory and swap totals in human-readable units. The available column estimates memory usable by new applications.
memory✓ Tested
Check that an image has layer history
Docker / Compose: history shows the instructions associated with image layers.
Docker / Compose✓ Tested
Check the size of a folder
Show a single total for the disk space used by a folder and its contents.
disk usage✓ Tested
Choose a service’s internal hostname
Docker / Compose: hostname controls the name reported inside the container.
Docker / Compose✓ Tested
Choose an action with switch
Map a small command value to a result.
switch✓ Tested
Choose an image’s default directory
Docker / Compose: Choose an image’s default directory with a complete introductory Dockerfile.
Docker / Compose✓ Tested
Choose the signal used for graceful stopping
Docker / Compose: The configured stop signal is recorded in container metadata.
Docker / Compose✓ Tested
Combine a stable entrypoint with default arguments
Docker / Compose: CMD supplies default arguments to an exec-form ENTRYPOINT.
Docker / Compose✓ Tested
Compress a file and keep the original
Create a gzip-compressed copy of a file while leaving the uncompressed original in place.
gzip✓ Tested