Section 5.3. Shell Operations


[Page 170 (continued)]

5.3. Shell Operations

When a shell is invoked, either automatically during a login, or manually from a keyboard or script, it follows a preset sequence:

1.

It reads a special startup file, typically located in the user's home directory, that contains some initialization information. Each shell's startup sequence is different, so I'll leave the specific details to later chapters.

2.

It displays a prompt and waits for a user command.

3.

If the user enters a Control-D character on a line of its own, this is interpreted by the shell as meaning "end-of-input," and causes the shell to terminate; otherwise, the shell executes the user's command and returns to step 2.

Commands range from simple utility invocations like this:

$ ls 


to complex-looking pipeline sequences like this:

$ ps -ef | sort | ul -tdumb | lp 


If you ever need to enter a command that is longer than a line on your terminal, you may terminate a portion of a command by a backslash (\) character, and the shell allows you to continue the command on the next line:

$ echo this is a very long shell command and needs to \ be extended with the line continuation character. Note \ that a single command may be extended for several lines. this is a very long shell command and needs to be extended with the line continuation character. Note that a single command may be extended for several lines. $ _ 





Linux for Programmers and Users
Linux for Programmers and Users
ISBN: 0131857487
EAN: 2147483647
Year: 2007
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net