Results for “Commands & execution context”
Small, practical examples. Search by task or narrow things down below.
Handle an expected command failure
Branch on a command’s exit code without aborting the script.
exit status✓ Tested
List files in a tar archive
Inspect the contents of a gzip-compressed tar archive without extracting any files.
tar✓ Tested
List running processes
Display process IDs, parent process IDs, and command names for all visible processes.
process✓ Tested
Open a link in a separate tab
Declare a separate browsing context with an explicit noopener relationship.
HTML✓ Tested
Pass an environment variable
Supply configuration without changing an image.
environment✓ Tested
Preserve a failure status while an EXIT trap runs
Bash Scripts: Capture the status immediately on entry to the trap before running cleanup commands.
Bash Scripts✓ Tested
Read a field from container metadata
Use an inspect template for stable machine-readable output.
inspect✓ Tested
Read a text file
Open a UTF-8 text file and read its contents. A context manager closes the file automatically, even if reading fails.
file✓ Tested
Read output from a completed container
Retrieve the stdout captured by Docker.
logs✓ Tested
Replace text with sed
Replace all occurrences of the substring old on each line and print the transformed text without changing the input file.
sed✓ Tested
Retrieve the result of an asynchronous task
C++: The explicit async launch policy requests asynchronous execution rather than deferred evaluation.
C++✓ Tested
Run a command in a running container
Execute an additional process inside an existing container.
exec✓ Tested