9.13 Multiline Commands, Secondary Prompts
Both the Bourne shell and the C shell support multiline commands.
In the Bourne shell, a newline following an open quote ( $ In the C shell, you can continue a line by
typing a backslash ( Obviously, this is a convenience if you're typing a long command line. It is a minor feature and one easily overlooked; however, it makes it much easier to use a program like sed (34.24 ) from the command line. For example, if you know you chronically make the typos "mvoe" (for "move") and "thier" (for "their"), you might be inspired to type the following command:
More importantly, the ability to issue multiline
commands lets you use the shell's programming
features interactively from the command line.
In both the Bourne and the C shell, multiline programming constructs
automatically generate a secondary prompt ( For example, here's a place to use my favorite programming construct for non-programmers, the for loop (9.12 ) : $ Or in the C shell with foreach (9.11 ) : % While a simple command like this could be saved into a shell script (1.5 ) , it is often even easier to use it interactively. Users of sed should of course makesure their script works correctly before overwritingtheir original file . (34.3 ) - |
|