Hi,
I make a sftp connection successfully.My requirement is the script shall execute only after i find a trigger file(dailyreport.OK.psv) in the remote dir. If the trigger file is not present ,the script should exit else it should continue with the rest of the scripts statements. Below code is having an issue in the if condition. Need help with this.
Last edited by Scott; 06-12-2013 at 02:04 PM..
Reason: Code tags, not ICode tags
I tried removing if outside of the sftp and made the below modification. The script is not able to find OK and gives a message as
My aim is to check the presence of this .OK file .If its present then i execute the rest of the statements else i quit . The script looks like :
You can't cram an if-statement together like that, spaces are needed around each token.
Also, you need if [ -f filename ] to look for a filename. But it takes one, and only one filename -- not zero, not three, one. So if * finds more than one file that's a syntax error.
Keeping that in mind I'd try this:
This uses an external utility, ls, so [ ] aren't needed. The point of this is that you can cram multiple files into ls and it's not an error, but if there's zero files, it will be fed the string /app/reporting/daily/temp/*OK* and will return error because that filename doesn't exist.
I want to add the total count of actual records which i want to add as a footer at the end. When i execute the script below i get RECORd_COUNT along with the file name .
Output is
How can i avoid the file name coming in the out for the record count ?
Hello,
I have file all_file.txt
at the end of process this file all_file.txt should be deleted only if there is no file present in dir /all_file/tmp/ or in it's sub directory.
can you please help me with the peace of code for this.
Thanks (2 Replies)
I have an HP-UX server that runs a script each night. The script connects to an SFTP server and downloads all xml files (if any are present) from a certain folder, and then deletes the files from the SFTP server. So sometimes it will download a new file, sometimes it will download 2 or 3 new... (4 Replies)
Hi,
Following script work fine:
#!/bin/bash
FILE=$1
if ; then
echo Yay
else
echo Boo
fi
But I would like to add another condition that if FILE... (3 Replies)
Hello,
I have to write a script to compare the sum of the amount fields in a source file and the amount field in another file.
details are:
based on the name of the source file (say SALES as an example), a file already available in a path will be grabbed (say SALES_ParmFile) and this file... (4 Replies)
hi everybody,
I need a quick help with this issue. I have configuration file in which the following set of strings must be present. I need to check it with the bash script (leading spaces are not significant). Check must be case insensitive. Can anybody help?
... any lines
<SECTION... (4 Replies)
Hi:
I'm not really a programmer, but I've created a small logout hook script to copy some specific directories to a server volume when a user logs out (10.6.4). These is a laptop user, so I'm looking find:
1) the command to check if the volume (including path to directory?) is available.
... (1 Reply)
My script is taking a file "input.in" as input for running the script. My worry is that i need to execute the script only if the file is present, if it's not don't perform the next commands.
Just to have a check at the beginning of the script : If "input.in" exists, then go on. If it's does not... (4 Replies)
Hi,
My os is sun solaris 5.10 and Korn shell scripting.
I have a file name like CCNA_EARLY_SWP.w062309
where 062309 is date in mmddyy .This is the value date of the file.(will
I need to check continously from 5.00 - 7.00 am daily for this file .
If the file has not come at 5 am or 7am... (4 Replies)
HI,
I have a script which will be running all the time...it is like a trigger.. wakesup every 10 minutes(trigger.sh) executes, and I want to write another script which monitors this script every one hour and if it finds that trigger script is not running it should start it and exit...and here... (9 Replies)