Command-Line Tools and Processes
-
Shell Commands and Program Arguments
A shell interprets a command line and starts a program with an argument list. The program receives the resulting values.
-
Single and Double Quoting in a POSIX Shell
Quoting controls how the shell interprets characters before constructing an argument. Different quoting forms permit different expansions.
-
Options and Operands in a Command
Options commonly choose behavior or set values, while operands supply objects such as input paths. An interface must document the actual syntax it accepts.
-
The Working Directory of a Shell Command
A relative path is generally resolved from the process's current working directory. Commands started by a shell normally inherit that directory unless their launcher changes it.
-
Shell Variables and the Process Environment
A shell can hold local variables. An exported variable can be passed to commands the shell starts, as specified by the shell.
-
Connecting Commands with a Pipe
A pipe can connect one process's ordinary output to another process's input. Each end sees a stream under its own interface.
-
Redirecting Command Streams to Files
Redirection associates an input or output stream with a selected file or other endpoint. It can change what is visible to the terminal.
-
Appending to or Replacing Command Output
A redirection can append output after existing bytes or open an ordinary file for replacement, depending on the specified operator and shell.
-
Keeping Command Output Machine-Readable
A command used in a pipeline should keep its data stream in the declared format, with unrelated progress and diagnostics directed separately.
-
Reading Exit Status Across Several Commands
A pipeline includes the outcomes of separate commands. The shell's reported pipeline status depends on its rules and settings.
-
Waiting for a Child Process to Finish
A parent can wait for a child process to finish and collect a result describing how it exited.
-
Giving a Child Process a Time Budget
A launcher can limit how long it waits for work. Its cancellation and cleanup behavior needs a separate contract.
-
Foreground and Background Work in a Shell
A foreground command normally occupies the shell's active job context until completion. Background work can run while the shell accepts more commands.
-
Signals and Process Shutdown
A process can receive operating-system notifications used for control. Available signals and handling rules depend on the platform.
-
Launching a Program with a Structured Argument List
A process launcher can often receive an executable and separate argument values directly. This avoids depending on shell interpretation for ordinary paths and settings.
-
Line-Oriented Command Pipelines
A line-oriented pipeline can filter or summarize rows as long as its tools agree on what a line and record mean.
-
Filename Globs and Text Patterns
A shell glob commonly expands to matching pathnames before a command runs. A text pattern supplied to a program may be interpreted by the program instead.
-
Locale and Ordering in Command-Line Workflows
A locale can influence collation, message text, or textual representations. Record it when those properties affect a result.
-
Finding an Executable through the Search Path
A shell can search an ordered list of directories to resolve an executable name. A different environment can select a different program with the same name.
-
Selecting the Interpreter for a Script
A script may be run by passing its path to an interpreter or by an operating-system mechanism that selects an interpreter on launch.
-
Quiet and Verbose Command Output
A command can provide different levels of diagnostic detail while preserving its documented data output and success signal.
-
Reading a Command's Help and Examples
A help display can identify accepted argument forms, defaults, and platform options. Concrete tests reveal behavior at ambiguous boundaries.
-
Supplying Command Input from a Test Runner
A test can launch a real command with controlled input bytes, working directory, environment, and arguments.
-
Collecting Both Outputs from a Child Process
When both output streams are piped, a parent must consume them in a way that allows the child to keep writing and finish.
-
Terminal and Captured Output Behavior
A command may detect whether it writes to a terminal and choose progress formatting or buffering that would be awkward in a data file.
-
Changes in a Shell and in Its Child Processes
A child normally receives an inherited environment and starting directory. Changing those settings in the child does not normally change the parent's environment.
-
Testing a Command with Synthetic Files
Synthetic fixtures let a test exercise format boundaries and error reporting without using real personal or production data.
-
Recording the Arguments of a Reproducible Command
A display of a command line should preserve argument boundaries or describe the original argument array directly.
-
Documenting What Command Exit Codes Mean
An application can give meaning to success and failure statuses that callers use to control a workflow.
-
Designing a Command for Other Programs to Use
A reusable command states how it reads data, what its success output contains, and how failures reach a caller.