Sams Teach Yourself Shell Programming in 24 Hours (Disney web site)
Tuesday, February 12th, 2008Sams Teach Yourself Shell Programming in 24 Hours Contents Index Hour 24: Shell Programming FAQs Previous Chapter Next Chapter Sections in this Chapter: Shell and Command Questions File and Directory Questions Variable and Argument Questions Summary Previous Section Next Section Hour 24 Shell Programming FAQs Each of the previous chapters has focused on an individual topic in shell programming, such as variables, loops, or debugging. As you progressed through the book, you worked on problems that required knowledge from previous chapters. In this chapter, I’m taking a slightly different approach. I will try to answer some common shell programming questions that frequently arise. Specifically I will cover questions from three main areas of shell programming: l The shell and commands l Variables and arguments l Files and directories Each section includes several common questions (along with answers) that occur in shell programming. These questions are designed to help you solve or avoid problems while programming using the shell. Some of the questions provide deeper background information about UNIX, whereas others illustrate concepts covered in previous chapters. Shell and Command Questions In this section I will cover some of the common questions that arise in regard to the shell itself. Also included are a few questions regarding the execution of commands. Why does #!/bin/sh have to be the first line of my scripts? In Chapter 2, “Script Basics,” I stated that #!/bin/sh must be the first line in your script to ensure that the correct shell is used to execute your script. This line must be the first line in your shell script because of the underlying mechanism used by a shell to execute commands. When you ask a shell to execute the command $ date, the shell uses the system call exec to ask the UNIX kernel to execute the command you requested. For those readers who are not familiar with the term system call, a system call is a C language function built in to the UNIX kernel that enables you to access features of the kernel. The shell passes the name of the command that should be executed to the exec system call. This system call reads the first two characters in a file to determine how to execute the command. In the case of shell scripts, the first two characters are #!, indicating that the script needs to be interpreted by another program
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.