I'm trying to check whether 3 files are existing and send 3 files as attachements.
If only two are there then send those two files as attachments.
if [ -s "ESSKPI" && -s "ESSORG" && -s "ESSROLE"]; then
elif [ -s "ESSKPI" && -s "ESSORG"]; then
I tired the above given syntax and then it is giving me an error
line 11: [: missing `]'
I tried with -a instead of && and that is also not working.
When i tried
if [ -s "ESSKPI"] && [-s "ESSORG" && -s "ESSROLE"]; then
elif [ -s "ESSKPI"] && [-s "ESSORG"]; then
This one is hanging and not doing anything.
Can somebody please help me with this?
I hope this will help you .....
just check with the square braces i hope this should work in your env
try to use {} in place of [] if it doesnt works
#!/bin/ksh
file1=/home/scott/a.txt
file2=/home/scott/b.txt
file3=/home/scott/c.txt
## -f is used for <file exists >
##verify whether there exist 3 files if it is true then send the files via attachement
IF [ ( -f $file1 ) -a ( -f $file2 ) -a ( -f $file3 ) ]
THEN
(uuencode $file1 $file1 ; uuencode $file2 $file2; uuencode $file3 $file3 ) |mailx -m -s "attachements" a@aol.in
##verify whether there exist 2 files if it is true then send the files via attachement
ELIF [ ( -f $file1 ) -a ( -f $file2 ) ]
(uuencode $file1 $file1 ; uuencode $file2 $file2) |mailx -m -s "attachements" a@aol.in
fi
Hi Palanisvr
I tried if [[ -s "$ESS_KPI_ERR" ]] && [[ -s "$ESS_ORG_ERR" ]] && [[ -s "$ESS_ROLE_ERR" ]]; then and it worked.
Thanks a lot for oyur help.