Commands, options and arguments
The parts of a command
A simple command usually starts with a command name and is followed by zero or more arguments. An argument is one value passed to the command. Some arguments are options that change its behavior; other arguments are operands or data. Each command defines which options it accepts. Bash itself first parses the command line and prepares the arguments.
Expected output when executed:
Learn Bashprintf is the command name. It receives two arguments: the format %s\n and the text Learn Bash. The space inside single quotes does not separate the text into two arguments. Spaces outside quotes can separate words.
Expected output when executed:
LearnBashNow there are three arguments after the command name: a format and two strings. The result has two lines. Quoting changes argument boundaries, not merely the appearance of the command.
Options change behavior
Expected output excerpt (full text varies by version):
GNU bash, version--version is an option recognized by the Bash executable. Long options often begin with two hyphens, while short options often begin with one, such as the -c introduced earlier. These are conventions, not universal rules. Consult the command’s documentation; do not assume every command accepts the same options.
Common mistake: quoting everything
Writing 'printf %s hello' as one quoted word asks Bash to find a command with that entire name; it does not split the word into a command and two arguments. Quote individual arguments that need it, not the entire command line. Later lessons cover expansions and more complex parsing.
Practice
Use one printf call to print Daily report on one line and Ready on the next. Identify the command name, format and two data arguments.
Next lesson: Create and run a Bash script