Test (Unix) - Functions

Functions

The following functions are used to construct this parameter:

-e FileName - FileName exists.

Note: All remaining functions return true if the object (file or string) exists, and the condition specified is true.

-b Filename - Returns a True exit value if the specified FileName exists and is a block special file. -c FileName - FileName is a character special file. -d FileName - FileName is a directory. -f FileName - FileName is a regular file. -g FileName - FileName's Set Group ID bit is set. -h FileName - FileName is a symbolic link. -k FileName - FileName's sticky bit is set. -L FileName - FileName is a symbolic link. -p FileName - FileName is a named pipe (FIFO). -r FileName - FileName is readable by the current process. -s FileName - FileName has a size greater than 0. -t FileDescriptor - FileDescriptor is open and associated with a terminal. -u FileName - FileName's Set User ID bit is set. -w FileName - FileName's write flag is on. However, the FileName will not be writable on a read-only file system even if test indicates true. -x FileName - FileName's execute flag is on. If the specified file exists and is a directory, the True exit value indicates that the current process has permission to change (chdir) into the directory. file1 -nt file2 - file1 is newer than file2. file1 -ot file2 - file1 is older than file2. file1 -ef file2 - file1 is another name for file2. (symbolic link or hard link)

Read more about this topic:  Test (Unix)

Famous quotes containing the word functions:

    The mind is a finer body, and resumes its functions of feeding, digesting, absorbing, excluding, and generating, in a new and ethereal element. Here, in the brain, is all the process of alimentation repeated, in the acquiring, comparing, digesting, and assimilating of experience. Here again is the mystery of generation repeated.
    Ralph Waldo Emerson (1803–1882)

    Adolescents, for all their self-involvement, are emerging from the self-centeredness of childhood. Their perception of other people has more depth. They are better equipped at appreciating others’ reasons for action, or the basis of others’ emotions. But this maturity functions in a piecemeal fashion. They show more understanding of their friends, but not of their teachers.
    Terri Apter (20th century)

    Nobody is so constituted as to be able to live everywhere and anywhere; and he who has great duties to perform, which lay claim to all his strength, has, in this respect, a very limited choice. The influence of climate upon the bodily functions ... extends so far, that a blunder in the choice of locality and climate is able not only to alienate a man from his actual duty, but also to withhold it from him altogether, so that he never even comes face to face with it.
    Friedrich Nietzsche (1844–1900)