FileExists.sh is a Bourne Shell script that helps you determine whether any file that matches your specified file masks exists. This script will return 1 or 0, which represents true and false respectively. This script returns true when one or more files are found using any of the file masks you specified on the command-line. Using this script, your other scripts can easily determine whether some files exist.
FileExists.sh is distributed as executable source code under the GNU General Public License. Please see the license agreement elsewhere on this site.
FileExists.sh mask1 [ . . . mask2 ]
: FileExists.sh "*.sh"
By the way, you can use this utility to test for files that are not in the current directory. In fact, you can test for files in multiple directories and this utility will return '1' if the file mask is found in any of the specified directories. Following are some examples.
what does 1 and 2 in line 25 stand for ???
"-1" is a "ls" flag to display file names in a single column. "2>" redirects stderr; in this case, redirects to /dev/null, which just throws away the stderr output.
Found an incompatibility issue with Ubuntu 12.10. This new attached version below resolves the incompatibility.
Did your message disappear? Read the Forums FAQ.
Spam Control | * indicates required field
No TrackBacks yet. TrackBack can be used to link this thread to your weblog, or link your weblog to this thread. In addition, TrackBack can be used as a form of remote commenting. Rather than posting the comment directly on this thread, you can posts it on your own weblog. Then have your weblog sends a TrackBack ping to the TrackBack URL, so that your post would show up here.
Messages, files, and images copyright by respective owners.
12 Users Online
Copyright © 1996 - 2018. All Rights Reserved.