Todos os livros

Profissional

Apps Sobre Coach Entrar Começar a ler

Computer Science · Glossário

O que é Pathname expansion, quoting, word splitting?

Também chamado de: pathname expansion · word splitting · quoting

Definition 8.8 University Computer Science — Year 1 · Capítulo 8 — The Shell

Pathname expansion replaces a word containing * (any string), ? (any one character) or [...] (one character of a set) by the sorted names of the files that match it, a glob; a pattern that matches nothing is left as it is, and names starting with a dot are matched only by a pattern starting with a dot. Word splitting cuts the result of an unquoted variable expansion into several words at spaces, tabs and newlines. Quoting suspends both: between single quotes every character is literal; between double quotes $ still expands variables but no splitting or pathname expansion happens; a backslash makes the next character literal.

The order in which the shell rewrites a command line (the tilde ~ is expanded with the variables). Quotes act at every step, braces included, and are removed last: that is why "$f" reaches the program as one word with the variable’s value, spaces and all.
The order in which the shell rewrites a command line (the tilde ~ is expanded with the variables). Quotes act at every step, braces included, and are removed last: that is why "$f" reaches the program as one word with the variable’s value, spaces and all.
Ler no capítulo →