Sponsored Content
Top Forums Shell Programming and Scripting check file exist before execution Post 302630033 by guddu_12 on Wednesday 25th of April 2012 09:52:40 AM
Old 04-25-2012
Hi Robin

How to use error code and message generated by ls, can you please give me an example
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to check if the file exist or not?

say i would like to check if the file is existed before i use rm command. How can i do it? i know if i can use find, but i would like to have a good interface (in a shell script) thks (3 Replies)
Discussion started by: gusla
3 Replies

2. Shell Programming and Scripting

how to check if directory/file exist using c/c++

Hi there,, how to check if directory/file exist using c/c++ under unix/linux? I can use access() under Window MFC. Thanks. Steven (1 Reply)
Discussion started by: steven88
1 Replies

3. Programming

how to check if directory/file exist using c/c++

Hi there, how to check if directory/file exist using c/c++ under linux/unix. Thanks. Steven (2 Replies)
Discussion started by: steven88
2 Replies

4. Shell Programming and Scripting

Check Word if exist on file or not

Hello, I want to check if some word exist or not on some file By Example : word is : nixcraft file called : /root/shell.txt and i want to check if nixcraft word exist on /root/shell.txt file with if statement or another tool Any Ideas (5 Replies)
Discussion started by: LinuxCommandos
5 Replies

5. Shell Programming and Scripting

Check if file exist

Hi Does anybody know how I can check if a file exists i.e. see bellow, this doesn't work by the way and if tried countless variations on this file1=$one/file111.txt if then echo "Present" else echo "Not present" fi result : Not present (file is already present, eventhough its... (3 Replies)
Discussion started by: gksenthilkumar
3 Replies

6. Shell Programming and Scripting

Check file exist issue

I have created two scripts, one with hardcoded and another one with extract from file instead of hardcoded, script:1 -------- #!/bin/ksh filename="$one/file1.dat" if then echo "$filename has arrived." >> $logfile else echo "$filename has NOT yet arrived." >> $logfile fi :> Result:... (4 Replies)
Discussion started by: gksenthilkumar
4 Replies

7. Shell Programming and Scripting

Check if file exist

Hi, I am trying to create a bash script which will check if file exist then remove that file else do nothing. I have to do same process for three files in same script. I have written code for one file and trying to run it. if then rm -r /user1/abc/File1 fi When I run this code it... (1 Reply)
Discussion started by: palak08
1 Replies

8. Shell Programming and Scripting

Check if file exist

Hi, I created following script to check if file exist: #!/bin/bash SrcDir=$1 SrcFileName=$2 SrcTimePeriod=$3 if ;then echo 1 else echo 0 fi I ran it like: /apps/Scripts/FileExist.sh /apps/Inbox file1 2nd_period_2010 Even file exist at that location, my above command is... (4 Replies)
Discussion started by: palak08
4 Replies

9. Shell Programming and Scripting

how to check file exist in a directory or not

HI folks, can any one tell me how to check whether the file is existed in a directory or not . let me tell you my requirement : if the file is existed i should display a one message or else i have to send a mail .. i have the mail logic .. but I'm failed to check file existence .. please... (5 Replies)
Discussion started by: sravan008
5 Replies

10. Shell Programming and Scripting

Check for a file and touch if not exist

Hi, I've a situation where i need to check for the file existence and create a zero byte file based on the parameter,in some cases i need to touch and in some case i dont need to touch with zero byte file please help me on parameterizing this touch command?? Regards. San (2 Replies)
Discussion started by: sandeep karna
2 Replies
syslog.h(3HEAD) 						      Headers							   syslog.h(3HEAD)

NAME
syslog.h, syslog - definitions for system error logging SYNOPSIS
#include <syslog.h> DESCRIPTION
The <syslog.h> header defines the following symbolic constants, zero or more of which can be OR'ed together to form the logopt option of openlog(): LOG_PID Log the process ID with each message. LOG_CONS Log to the system console on error. LOG_NDELAY Connect to syslog daemon immediately. LOG_ODELAY Delay open until syslog() is called. LOG_NOWAIT Do not wait for child processes. The following symbolic constants are defined as possible values of the facility argument to openlog(): LOG_KERN reserved for message generated by the system LOG_USER message generated by a process LOG_MAIL reserved for message generated by mail system LOG_NEWS reserved for message generated by news system LOG_UUCP reserved for message generated by UUCP system LOG_DAEMON reserved for message generated by system daemon LOG_AUTH reserved for message generated by authorization daemon LOG_CRON reserved for message generated by clock daemon LOG_LPR reserved for message generated by printer system LOG_LOCAL0 reserved for local use LOG_LOCAL1 reserved for local use LOG_LOCAL2 reserved for local use LOG_LOCAL3 reserved for local use LOG_LOCAL4 reserved for local use LOG_LOCAL5 reserved for local use LOG_LOCAL6 reserved for local use LOG_LOCAL7 reserved for local use The following is declared as a macro for constructing the maskpri argument to setlogmask(). The following macro expands to an expression of type int when the argument pri is an expre ssion of type int: LOG_MASK(pri) a mask for priority pri The following constants are defined as possible values for the priority argument of syslog(): LOG_EMERG A panic condition was reported to all processes. LOG_ALERT A condition that should be corrected immediately. LOG_CRIT A critical condition. LOG_ERR An error message. LOG_WARNING A warning message. LOG_NOTICE A condition requiring special handling. LOG_INFO A general information message. LOG_DEBUG A message useful for debugging programs. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
syslog(3C), attributes(5), standards(5) SunOS 5.10 10 Sep 2003 syslog.h(3HEAD)
All times are GMT -4. The time now is 10:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy