I think the proper construct is -e, however I am a novice shell programmer
The -e switch can only handle one file at a time, so if you want, you can build an array of file paths and loop it for checks. So, lets say you wanted to check for multiple files...
This will allow you to maintain a list of files to check, and if the file doesn't exist it will create it. Also, if this is run as root, it will create the file as root as the owner. So, you may have to add another part if you don't want root to own the file.
We have data files that are ftp'd every morning to a SUN server. The file names are exactly the same except for that each has the date included in its name. I have to write script to do 2 things:
STEP 1) Verify that the file arrived in morning.
STEP 2) Compare the file size of the current... (3 Replies)
Hi everyone, I'm brand new to shell scripts (and UNIX in general) and I've been able to figure everything out except this...
I want to write a script that will take a filename as an argument, append the date to it (IE Dec 24 2008) and make sure it doesn't already exist, if so, add an integer to... (4 Replies)
I have list of ‘tar' format files in a folder. I want to check a particular file is exists in the tar files. Currently I am using the below command to check the scenario.
tar -tvf first.tar | grep ‘myfile.txt'
The command able to searched a single ‘tar' file only. But I want to search... (7 Replies)
Hey all,
I'm brand new to script writing, I'm wanting to make a script that will ask for a file and then retrieve that file if it exists, and if it doesn't exist, create the file with the desired name, and I'm completely stuck.. so far..
#! bin/bash
echo "Enter desired file"
read "$file"
if ... (5 Replies)
Hi,
I am looking for a shell script with the following.
1. It should check whether a particular file exists in a location
#!/bin/sh
if ;
then
echo "xxx.txt File Exists"
else
echo "File Not Found"
fi
2. If file exists, it should check for the modified date and run a command... (2 Replies)
I want to write a script to see if various files exist. What I want to do is have the script search in various directories if a file exist, and if not, then output something like "/path/file does not exist". I don't actually know of how to check and see if a file exists or not. What I have in mind... (2 Replies)
Hi,
I am using solaris 10 OS and bash shell.just checking for small code snippet which follows below.
/export/home/vomappservers/spa/common/5.0
/export/home/vomappservers/spa/common/scripts
/export/home/vomappservers/spa/tools
/export/home/vomappservers/spa/scm5.0/SCCS... (5 Replies)
Hi,
I am using an expect script to roll out an ssh key to multiple servers. I have a problem as on some of them the authorized_keys file exists and on some it doesn't. Where it exists I need to >> the key in and where it doesn't I need to create the file then sftp the file over.
So I need some... (2 Replies)
Hi,
I have the below code written. However I am not getting the desired output
I am checking if the particular path has file in it.
#!/bin/bash
ls -l /IRS2/IRS2_ODI/INFILE/*LS* 1>/dev/null 2>/dev/null
if
then
echo $?
echo "File Exists"
fi
... (3 Replies)
I need to check whether a file exists and has been changed.
The file should contain a specific string. The file should also have been changed within the last ten seconds.
How do I do that? (3 Replies)
Discussion started by: locoroco
3 Replies
LEARN ABOUT PHP
function_exists
FUNCTION_EXISTS(3) 1 FUNCTION_EXISTS(3)function_exists - Return TRUEif the given function has been definedSYNOPSIS
bool function_exists (string $function_name)
DESCRIPTION
Checks the list of defined functions, both built-in (internal) and user-defined, for $function_name.
PARAMETERS
o $function_name
- The function name, as a string.
RETURN VALUES
Returns TRUE if $function_name exists and is a function, FALSE otherwise.
Note
This function will return FALSE for constructs, such as include_once(3) and echo(3).
EXAMPLES
Example #1
function_exists(3) example
<?php
if (function_exists('imap_open')) {
echo "IMAP functions are available.<br />
";
} else {
echo "IMAP functions are not available.<br />
";
}
?>
NOTES
Note
A function name may exist even if the function itself is unusable due to configuration or compiling options (with the image func-
tions being an example).
SEE ALSO method_exists(3), is_callable(3), get_defined_functions(3), class_exists(3), extension_loaded(3).
PHP Documentation Group FUNCTION_EXISTS(3)