instead of executed directly. The rest of the (Web hosting)
instead of executed directly. The rest of the line is treated as the name of the interpreter to use. Usually the interpreter is /bin/sh, but you can also specify options to the shell on this line. Sometimes options such as -x or -nv are specified to enable debugging. This also enables you to write scripts tuned for a particular shell such as ksh or bash by using /bin/ksh or /bin/bash instead of /bin/sh. How can I access the name of the current shell in my initialization scripts? In your shell initialization scripts, the name of the current shell is stored in the variable $0. Users who have a single .profile that is shared by sh, ksh, and bash use this variable in conjunction with a case statement near the end of this file to execute additional shell specific startup. For example, I use the following case statement near the end of my .profile to set up the prompt, PS1, differently depending on the shell I am using: case “$0″ in *bash) PS1=”t h #$ ” ;; *ksh) PS1=” uname -n !$ ” ;; *sh) PS1=” uname -n $ ” ;; esac export PS1 I have specified the shells as *bash, *ksh, and *sh, because some versions of UNIX place the - character in front of login shells, but not in front of other shells. How do I tell whether the current shell is interactive or noninteractive? Some scripts will need the capability to determine whether they are running in an interactive shell or noninteractive shell. Usually this is restricted to your shell initialization scripts because you don’t want to perform a full-blown initialization every time these scripts execute. Some other examples include scripts that can run from the at or cron commands. Two common methods can determine whether a shell is interactive: l test -t or [ -t ] l tty -s Both commands exit with zero status if STDIN is connected to a terminal. For example, the commands $ if [ -t ] ; then echo interactive ; fi and $ if tty -s ; then echo interactive ; fi
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.