Sri lanka web server - -G file Does the file exist and is

-G file Does the file exist and is its group ownership the same as the current user s primary group? -k file Does the file have the sticky bit set? -L file Is the file a symbolic link? -n string Is the length of the string greater than 0 bytes? -O file Does the file exist and does the current user own it? -p file Is the file a named pipe? -r file Does the file exist, and is it readable? -s file Does the file exist, and is it larger than 0 bytes? -S file Does the file exist, and is it a socket? -t fd Is the file descriptor open? -u file Does the file have the set-user-id bit set? -w file Does the file exist, and is it writable? -x file Does the file exist, and is it executable? -z string Is the length of the string 0 bytes? expr1 -a expr2 Are both the first expression and the second expression true? expr1 -o expr2 Is either of the two expressions true? file1 -nt file2 Is the first file newer than the second file (using the modification timestamp)? file1 -ot file2 Is the first file older than the second file (using the modification timestamp)? file1 -ef file2 Are the two files associated by a link (a hard link or a symbolic link)? var1 -eq var2 Is the first variable equal to the second variable? var1 -ge var2 Is the first variable greater than or equal to the second variable? var1 -gt var2 Is the first variable greater than the second variable? var1 -le var2 Is the first variable less than or equal to the second variable? var1 -lt var2 Is the first variable less than the second variable? var1 -ne var2 Is the first variable not equal to the second variable? When the expression is evaluated, the result is either a 0 (indicating “true”) or a 1 (indicating “false”). Here are some examples that demonstrate the uses of the if statement and a test expression: if [ -x /sbin/ifconfig ] if [ $4 -eq “nl” ] if [ $# -gt 2 ] if [ -z $HOSTNAME ] In the previous example, the first statement checks if the /sbin/ifconfig program is executable. The second example checks if the string value nl is equal to the value stored in $4 (the fourth command-line argument). The next line checks if the number of command-line arguments (represented by the $# variable) is greater than two. The last example determines if the variable $HOSTNAME is empty. The case command for nested if statements Another frequently used construct is the case command. Similar to a switch statement in programming languages, this can take the place of several nested if statements. A general form of the case statement is as follows: case “VAR” in Result1) { body } ;; Result2) { body }
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Leave a Reply