Built-in Programs and External Programs the output beside the Bash shell, which was used to launch it. Try it out by typing csh, followed by ps: $ csh $ ps PID TTY TIME CMD 5355 pts/0 00:00:00 bash 5389 pts/0 00:00:00 csh 5409 pts/0 00:00:00 ps It should be noted that when we say that we ’switch’ to another shell, we do not actually exit Bash and start csh; rather we use bash as the launchpad to start another shell, in this case csh. We’ll be looking at the ps command in more detail in the next section. Built-in Programs and External Programs There are two different types of command that can be executed from a shell. They are built-in programs and external programs: Built-in programs are inherently built into the shell: All shells share a common set of built-in programs, such as the cd command, which enables us to change directory. In addition, there are other built-in commands that are specific to certain flavors of the shell. For instance, the amend method for setting environment variables usually varies from one flavor of the shell to another. We shall see more on setting environment variables later in this chapter. External commands are those that are independent of the flavor of shell. They can be executed from any shell and yield more or less the same result. For instance, the date command would output the date no matter what shell it is executed from. For the purpose of our discussion, we shall refer to both built-in commands and external commands by the generic term, command. Checking Compatibility of a Command with a Shell Of course, when we’re working within a particular shell, we can use only the built-in commands that are valid for that flavor of shell. As we’ll see later, this is particularly important when we write a shell script - a file that contains a sequence of shell commands. If we run a shell script within a particular shell, then it should contain only commands that are valid for the shell in question. To this end, it is useful to be able to check whether a given command is a built-in or an external command. For this, we can use the type command. This command tells us whether it is a built-in command within the current shell, or (if it is an external program) the location of the command. For example, in the Bash shell, if you use type to query the nature of the date and cd commands, you’ll find that the former is external and the latter is built-in: $ type date date is /bin/date $ type cd cd is a shell builtin 163
Hint: If you are looking for high quality webhost to host and run your jsp application check Vision web hosting jsp services