12-19-2007
[Note to the people running this website: I received the following email over a day ago that someone responded to my original posting. And yet, it has never appeared here! I always see just 0 replies. Whats up? Is this website buggy?
When I try clicking on the "Contact us" link on the bottom of the page, I get an "Invalid Forum specified" error message, and when I try to click on the administrator link within that error message I get the same error message again.
If someone reading this knows how to contact the technical people running this website to notify them of these bugs, I would be grateful.
Since my posts do seem to be appearing on these forums, I am going to copy the text of the email that was sent to me and paste it below:]
ok, since you have gone to the trouble to post this, I will give some feedback which would make this more usable/portable. Currently it will not work on a stricter POSIX implementation of Unix due to your use of extented option from GNU find.
1. Your set -u is doing nothing at all since you have defaults for the only variables you use.
2. Use either a variable set to the full path (preferable) for a full path to programs you run.
eg
Code:
---------
FIND=/usr/bin/find
...
$FIND $opt_p $opt_R -type f -iname "*.sh"...
---------
3. Use POSIX arguments to find, it takes more work but is portable.
4. Instead of saying that the script will exit, print a usage message, you have that in the comments, but a usage message is better.
As an improvement, instead of assuming bourne/bourne compatability, test for a magic number in the first line of the script and run the <script interpreter> -n based on that, if there is none, then by all means default to using bourne.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Is it possible to check the script syntax with some sort of command...? Without running the script .
I'm using Sun Solaris (3 Replies)
Discussion started by: bjornrud
3 Replies
2. Shell Programming and Scripting
Hi,
I have a really, what I hope is, simple question.
I'm looking for a simple way to see whether a file exists or not and then perform an action based on whether it exists or not. An example of what I tried is as follows:
if
then {
echo "File mysql exists"
... (1 Reply)
Discussion started by: _Spare_Ribs_
1 Replies
3. Shell Programming and Scripting
Hi, Need help for a Script for checking and reporting database file sizes in a directory.
Request you to please give your valuable inputs.
Thanks a lot in advance.
Best Regards,
Marconi (1 Reply)
Discussion started by: marconi
1 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I'm trying to check a filesize within a script and then excute a relevant action. An example is below:
if
then rm $filename
rm $filename2
elif
then rm $filename2
fi
Basically if $filename2 has a filesize of 0 then I want both files to be removed, but... (6 Replies)
Discussion started by: chris01010
6 Replies
5. Shell Programming and Scripting
To check a bash script syntax without executing it we use:
bash -n scriptname
What should be the equivalent command for checking a ksh script? (8 Replies)
Discussion started by: proactiveaditya
8 Replies
6. Shell Programming and Scripting
All,
Is there a way to keep checking for a file over and over again in the same script for an interval of time?
Ie
If {
mail -user
continue checking until file arrives
file arrives
tasks
exit
I don't want the script to run each time and email the user each time a file... (4 Replies)
Discussion started by: markdjones82
4 Replies
7. Shell Programming and Scripting
I am trying to write a script that checks whether or not, a file exists on multiple servers.
My code / logic so far is:
#!/usr/bin/ksh
print "Enter File name to be checked"
read MYFILE
ssh server1 "
cd /var/opt/logs ;
if
then
... (4 Replies)
Discussion started by: momin
4 Replies
8. Shell Programming and Scripting
Hi, Gurus,
I need a scripts to check specified file if it exists or not at certain time (say every month between 5th and 7th). if file exists do something otherwise do another thing.
can anybody help this?
Thanks in advance
:wall: (3 Replies)
Discussion started by: ken002
3 Replies
9. Shell Programming and Scripting
#!/bin/ksh
#This script will check status of load balancer in AIX servers from hopbox
#Steps to do as folows :
#Login to server
#netstat -ani | grep <IP>
#check if the output contains either lo0 OR en0
#if the above condition matches, validation looks good
#else, send an email with impacted... (7 Replies)
Discussion started by: vinil
7 Replies
10. Shell Programming and Scripting
Hello,
I have a directory where sometimes appear a certain file name - and I'd like to be notified by email when that happens... so what command or script I may use?
e.g. if there's a file named "adam" in the directory named "dir1" then send a mail to "abc@abc.com".. it needs to permanently... (5 Replies)
Discussion started by: netrom
5 Replies
pathchk(1) General Commands Manual pathchk(1)
NAME
pathchk - Checks path names
SYNOPSIS
pathchk [-p] pathname...
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
pathchk: XCU5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
OPTIONS
Performs path name checks based on POSIX portability standards. An error message is sent if any of the following conditions are true: The
byte length of the full path name is longer than allowed by POSIX standards ({_POSIX_PATH_MAX}). The byte length of a component is longer
than allowed by POSIX standards ({_POSIX_NAME_MAX}). A character in any component is not in the portable file name character set.
OPERANDS
The path name to be checked.
DESCRIPTION
The pathchk command checks that one or more path names are valid (that is, they can be used to access or create a file without causing syn-
tax errors) and portable (that is, no file name truncation will result).
By default, the pathchk command checks each component of each path name specified by the pathname argument based on the underlying file
system. If the -p option is not specified, pathchk sends an error message if any of the following conditions are true: The byte length of
the full path name is longer than allowed by the system ({PATH_MAX} bytes). The byte length of a component is longer than allowed by the
system ({NAME_MAX} bytes). Search permission is not allowed for a component. A character in any component is not valid in its containing
directory.
It is not considered an error if one or more components of a path name do not exist, as long as a file matching the path name specified by
the pathname argument could be created without violating any of the preceding criteria.
EXAMPLES
To check the validity and portability of the /u/bob/work/tempfiles path name, enter: pathchk /u/bob/work/tempfiles To check the validity
and portability of the /u/bob/temp path name for POSIX standards, enter: pathchk -p /u/bob/temp
ENVIRONMENT VARIABLES
The following environment variables affect the execution of pathchk: Provides a default value for the internationalization variables that
are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization
variables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string
value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of
bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the
format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of
LC_MESSAGES.
FILES
System maximum values
EXIT STATUS
The pathchk command returns the following exit values: All path name operands passed the checks. An error occurred.
SEE ALSO
Commands: test(1)
Files: limits(4)
Standards: standards(5)
pathchk(1)