Web hosting control panel - Notice that we have not used any filename
Saturday, April 28th, 2007Notice that we have not used any filename extension, or suffix, on this example; Linux, and UNIX ingeneral, rarely makes use of the filename extension to determine the type of a file. We could have used.sh or added a different extension if we wished, but the shell doesn t care. Most preinstalled scripts willnot have any filename extension, and the best way to check if they are scripts or not is to use the filecommand, for example, file firstor file /bin/bash. Use whatever convention is applicable whereyou work, or suits you. Making a Script ExecutableNow that we have our script file, we can run it in two ways. The simpler way is to invoke the shell withthe name of the script file as a parameter, thus: $ /bin/sh firstThis should work, but it would be much better if we could simply invoke the script by typing its name, giving it the respectability of other Linux commands. We do this by changing the file mode to make the file executable for all users using the chmodcommand: $ chmod +x firstWe can then execute it using the command$ firstYou may get an error saying the command wasn t found. This is almost certainly because the shell envi- ronment variable PATHisn t set to look in the current directory for commands to execute. To change this, either type PATH=$PATH:.on the command line or edit your .bash_profilefile to add this commandto the end of the file; then log out and log back in again. Alternatively, type ./firstin the directory con- taining the script, to give the shell the full relative path to the file. Specifying the path prepended with ./does have one other advantage: It ensures that you don t acci- dentally execute another command on the system with the same name as your script file. You shouldn t change the PATHvariable like this for the superuser. It s a securityloophole, because the system administrator logged in as root can be tricked intoinvoking a fake version of a standard command. One of the authors admits to doingthis once, just to prove a point to the system administrator about security, of course! It s a slight risk on ordinary accounts to include the current directory in the path, soif you are particularly concerned, just get into the habit of prepending ./to all com- mands that are in the local directory. Of course, this isn t the only way to use chmodto make a file executable. Use manchmodto find out more about octal arguments and other options. 26Chapter
Note: If you are looking for cheap webhost to host and run your apache application check Vision apache web hosting services