Web hosting india - File ConditionalResult-d fileTrue if the file is a
File ConditionalResult-d fileTrue if the file is a directory. -e fileTrue if the file exists. Note that, historically, the -e option has notbeen portable, so -f is usually used. -f fileTrue if the file is a regular file. -g fileTrue if set-group-id is set on file. -r fileTrue if the file is readable. -s fileTrue if the file has nonzero size. -u fileTrue if set-user-id is set on file. -w fileTrue if the file is writable. -x fileTrue if the file is executable. We re getting ahead of ourselves slightly, but following is an example of how we would test the state ofthe file /bin/bash, just so you can see what these look like in use: #!/bin/shif [ -f /bin/bash ] thenecho file /bin/bash exists fiif [ -d /bin/bash ] thenecho /bin/bash is a directory elseecho /bin/bash is NOT a directory fiBefore the test can be true, all the file conditional tests require that the file also exists. This list containsjust the more commonly used options to the testcommand, so for a complete list refer to the manualentry. If you re using bash, where testis built in, use the help testcommand to get more details. We ll use some of these options later in the chapter. Now that we know about conditions, we can look at the control structures that use them. You may be wondering what the set-group-id and set-user-id (also known as set-gidand set-uid) bits are. The set-uid bit gives a program the permissions of its owner, rather than its user, while the set-gid bit gives a program the permissions of itsgroup. The bits are set with chmod, using the s and g options. Remember that set-gidand set-uid flags have no effect when set on shell scripts. 34Chapter
Note: In case you are looking for affordable webhost to host and run your web application check Vision http web server services