Here is an example of the case statement: Note that the double semi colons are required after each case in the statement. the * is the default case. added code tags for readability --oombera
I didn't try you script but just want to ask few questions on your script.
From the beginning, you 'cd to $SSM_IN_DIR' and then store this path to $fail_path. After this, you 'cd $fail_path | ls -lsf'. Why don't simply use ls -lsf?
If the batah_count is 0, I think it also pass this code. So you may make a code at the beginning:
batch_count=`ls | wc -w` #No need to sort in your case
if [[ $batch_count = 0 ]]; then
echo "There are no failed files in the ${fail_path} directory.
exit
fi
It is used to replace your code where in the last part. I think that if nothing to do. Quit from the script earlier rather than read through all content but do nothing.
Actually I didn't know the useful of batch_count2. Because in your script I just found three cases.
batch_count = 0 No remove
"batch_count = 1" and "batch_count > 1" Both remove file but only different in echo message.
So "batch_count2 -lt 1" actually same as "batch_count = 0"
From your script, "batch_count2 -gt 1" might not work because if batch_count is 2.
Agree with google, using 'case' may more convenience in your case.
I am setting up a system as an ADSL gateway. ADSL is working fine. PF is not forwarding for some reason.
# ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33196
priority: 0
groups: lo
inet6... (0 Replies)
I am trying to make all the fields containing lower case letters upper case and the third field of a file display ** instead.
I have this:
awk '{printf "%s %s ** %d %d\n", $1, $2, $4, $5}' database.txt | tr '' '' < database.txt
And that only changes it to upper case, other... (4 Replies)
What I have here is a pretty textbook recursive function. Its purpose right now is simply to display all folders that don't contain folders.
It works fine in all instances I can think of... except one. If there is a folder with a space in its name, the thing goes Kablooie.
AFAIK the problem comes... (5 Replies)
I am aware this question has been answered time and again. I feel I have tried everything I have seen on the net and really need help to get this working.
Same old story. Shell script, working from command but not from cron. I need my script to take values from a .properties file. Tried... (2 Replies)
Hello All
I have a set of files, each one containing some lines that follows that regex:
regex='disabled\,.*\,\".*\"'and here is what file says about each files:
file <random file>
<random file> ASCII text, with CRLF line terminatorsSo, as an example, here is what a file ("Daffy Duck - The... (3 Replies)
I try to compare the day and month of someones birthday with the day and month of today, so my little bash script can send a mail to the person that has its birthday that day.
The first line of the file birthdays looks like this:
firstname,lastname,01/01/1990,....
The variable birthday's... (4 Replies)
I have a cronjob that I need to run everyday and it needs to have todays date inputed, here is what I have, but is not working as expected..........
23 02 * * * cd /path;./RequestSummaryReport.sh $(date +%Y-%m-%d)
the output from mail gives me.............
Date: Fri, 8 Feb 2008 02:12:07... (4 Replies)
How to use OR with If for string comparison??
What is wrong in these two codes??
1.
if test $1 != "SO" OR $1 != "NO"
then
echo "Invalid"
else
echo "Valid"
2.
if(( $1 != "SO" || $1 != "NO" ))
then
echo "Invalid"
else
echo "Valid"
Please help? (2 Replies)
I'm trying to set up a secure and trusted connection between 2 boxes running solaris using ssh2.
I've run ssh-keygen2 on the local box and on the remote box, created the identification file ( IdKey id_dsa_2048_a ) on the local machine and copied across the public key file from the local to... (5 Replies)
i keep getting the following error with the code segment below when i try to compile the program.
The code is from 'defs.h'
parse error before '('
parse error before ')'
stray '\' in program
this is the code segment and the error is on the second line of the segment
#define... (1 Reply)