I have another Korn shell question. I am writing a script that will ftp a file from my production database to my test database.
To this, I have to construct a loop that checks a specified folder for a file.
If the file exists, I want it execute the ftp protocol and then exit.
If it does not see the file, I want it loop 9 times and sleep for 70 seconds at the end of every loop.
Once the 9 loop happens, I want a specified statement to given then exit out of the entire process.
As the below code illustrates I am using an “if” statement within a while loop to accomplish this task.
In addition, in order to establish where the file exists in the specified directory, I created a variable that uses a grep -c "phrase" to which will give me 0 or 1.
The issue that I am having is that my grep command is passing me an error stating
I have tested the command from the command line and it gives me a numerical value.
I do not know what is causing the problem. Any assistance that you can give would be appreciated.
I am just learning Korn shell programming so my grasp of the syntax is very limited. The code is as follows: error message
Last edited by Franklin52; 02-10-2010 at 03:15 PM..
Reason: Please indent your code and use code tags!!
It may be a problem with your quoting.
You have nested double quotes..
I think you want something like:
If you don't want the inner double quotes to be evaluated, u need to use single quotes, or escape the double quote.
One thing to learn is if you use single quotes, special characters will not be evaluated. If you use double quotes, then special chars will be evaluated. Single quotes are used to hide the meaning of special characters like $, *, \, !, ", ` and /. Any characters between single quotes, except another single quote, are displayed without interpretation
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Hi,
The problem statement is: I am trying to read line by line from a flat file by using a while loop. The... (9 Replies)
Hi I have the following Korn script having multiple for loops.
#!/bin/ksh
EXPECT=/usr/local/bin/expect
exp_internal
for d in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 i22 23 24 25 26; do
for i in 01 02 03 04 05 06 07 ; do
for h in 00 01 02 03 04 05 06 07 08 09 10 11 12... (2 Replies)
Hi ,
I might be asking a silly question but I just wonder if I can design/create my webpages using korn Shell or bash instead or using perl or php.This webpages I want to create are basically to perform admin work. With Perl the limitation for me is the fact of having to compile and install... (1 Reply)
Ho do I find out the verion of the Kron shell on my client`s system ?
There is no one to ask. They are not knowledged enough (hard to believe but yes).
Also, on that AIX 4.2, I am trying to figure out how to do a grep using a search patter like below but does not seam to work. The '*' do... (11 Replies)
i can able to transfer a file from build server(AIX)to webserver using ksh through ftp.my query is to check the existence of file while transfering from one server to other .i.e i need some command or script that checks the existence of file with same name in both server,within ftp syntax.
... (1 Reply)
I want to FTP multiple files in a directory that the files were created since midnight of the same day using korn shell. I can use the "find" command using -newer arguement that compares against a time stamp file. The script identifies the files, I can't use a variable = `find . ` as the... (2 Replies)
Hi guys,
i need to script the sending of multiple files through one ftp session. I have done this so far:
----------------------------------------------------------------
#!/bin/sh
USER=myuser
PASSWD=mypass
filenum=$1
x=0
ftp -n 159.167.95.199 <<SCRIPT
user $USER $PASSWD
binary
while ... (4 Replies)
Hi all,
can any tell if we can get Indian edition of korn shell programming by example by O'brain from QUE publications. I tried to and did not find. If any one is having the infi then pls let me know.
thanks in advance.
ksrsarma (0 Replies)
Hi,
I am trying to write a script which will loop until a certain action has been performed. I have two files i would like to compares.
For example:
file1 has a list of user ids (about 900) from the company's e-mail server.
file2 has a list of user ids (about 50 or so) from... (7 Replies)
I am facing problem while accesing FTP related commands in nawk code in bourne shell programming.I can able to connect to remote machine, but i can't able to get files from that machine.
Please help me in this.If you send code along with the solution, then it will be usefull for me. (4 Replies)