Full Discussion: Korn Shell Errors
Top Forums UNIX for Dummies Questions & Answers Korn Shell Errors Post 56563 by google on Tuesday 5th of October 2004 05:48:00 PM
Here is a formatted version of your script. I made a
half-hearted attempt to look at your script. I noticed
that you still have code segments spanning multiple
lines - you cant do that. You also had an "if" statement
that was not closed. I fixed that. The function "function getfilesandcopy" does not have a closing brace,
furthermore, its never actually called! A fatal design flaw
to say the least! Lastly, you had a ";" after your "if"
test at line 75. I removed that. Now that there arent
any more syntax errors (that the shell complained about)
I would suggest you fix your design flaws!!!

# Filename: factset_transfer
# Author: Steven bowskill
# Description: This file is the main script for the PA BATCHING FactSet automation
#set -vx
  printLog "$1: $2"
  exit $1


function getfilesandcopy

##set up some vars
##export them now

export paremote_node
export paremote_user
export paremote_password
export paftpcommand
export pafileExt
export paftptransmethod
export paftpPramFile

#create the file of the xls file in then this file will also contain the accounts

awk -F']' '/]/ {print $2}' $1 > $palocal_check/factsereports.txt

# now go thru this file lookgin for the account 
for acct in `cat $palocal_check/factsereports.txt`
  echo "Start to search **************************************************************"

#get the factset file 
filetoDownload=`echo $acct | awk -F',' '{print $1}'`

#get the xls file to download
XlsfiletoDownload=`echo $acct | awk -F',' '{print $1}'`

filetoDownload=`echo $acct | awk -F',' '{print $2}'`
filetoDownload=`echo $filetoDownload | awk -F'_' '{print $1"_"$2"_"$3"_"$4}'`

printLog "searching for ${filetoDownload}" 

cut -d "/" -f2-10 $palocal_check/dirs.txt > $palocal_check/dirsfound.txt 

cat $palocal_check/dirsfoundd.txt

##get the correct name of the file from the dirs.txt file 
##NewFileToCopy=`awk -F, '/' $filetoDownload'/ {print $3}' $palocal_check/dirs.txt`
##echo $NewFileToCopy

DirectoryFound=`cat $palocal_check/dirsfound.txt`

#did we get a match 
if [ ! -z ${DirectoryFound} ] ; 
  while read dirs
    #now ch
    #eck the file exists here 
    printLog xls file $XlsfiletoDownload
  if [ -f ${XlsfiletoDownload} ]
     #first lets rename the factset file 
     # cp ${palocal_check}/$XlsfiletoDownload ${palocal_check}/${filetoDownload}.xls 
     ##now need to ftp the file from sun42 tothe g drive set up the ftp vars
     #export the vars
     export padataname
     export paremote_dir
     export palocal_dir
     # now ftp the file
     printLog "Ftp ${filetoDownload} to ${dirs} this is the factset file ${XlsfiletoDownload} " 

     #copy the xls file
     cp ${palocal_check}/$XlsfiletoDownload ${palocal_check}/${filetoDownload}.xls 
     #now delete the xls file from factset this will tell us what was not found 
     rm ${palocal_check}/$XlsfiletoDownload

Test Your Knowledge in Computers #343
Difficulty: Medium
Scott McNealy, Andy Bechtolsheim, and Vinod Khosla, all Caltech graduate students, founded Sun Microsystems.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Korn Shell

Hi I am new to shell programming. I need help to write a script to monitor a process on Sun OS. If the process fails then call a oracle procedure. i check the process if running by typing ps -ef | grep ESP | grep -v grep root 29002 1 0 Mar 18 ? 7:20... (4 Replies)
Discussion started by: gpanesar
4 Replies

2. Shell Programming and Scripting

KORN Shell - Spawn new shell with commands

I want to be able to run a script on one server, that will spawn another shell which runs some commands on another server.. I have seen some code that may help - but I cant get it working as below: spawn /usr/bin/ksh send "telnet x <port_no>\r" expect "Enter command: " send "LOGIN:x:x;... (2 Replies)
Discussion started by: frustrated1
2 Replies

3. Shell Programming and Scripting

how to convert from korn shell to normal shell with this code?

well i have this code here..and it works fine in kornshell.. #!/bin/ksh home=c:/..../ input=$1 sed '1,3d' $input > $1.out line="" cat $1.out | while read a do line="$line $a" done echo $line > $1 rm $1.out however...now i want it just in normal sh mode..how to convert this?... (21 Replies)
Discussion started by: forevercalz
21 Replies

4. UNIX for Dummies Questions & Answers

bourne shell or korn shell?

Hi, I have a script that uses "nohup" command to execute a korn shell script. Which one is the correct shell to use bourne shell or korn shell to execute a korn shell? and why? Thanks in advanced. (2 Replies)
Discussion started by: XZOR
2 Replies

5. Shell Programming and Scripting

how can i call one korn shell from a shell

Hi guys, please help me I have a ksh script (second picture down), in that script I define the function DATECALC. Now I want to use this function KSH in a program shell. How can I call this ksh from my shell program? My shell program is... in the first two lines I tried to call... (1 Reply)
Discussion started by: acevallo
1 Replies

6. Shell Programming and Scripting

korn shell

I am using korn shell but I want to have my prompt to represnent that of my C shell because I like it better. Is there anyway to do this? (1 Reply)
Discussion started by: vthokiefan
1 Replies

7. Shell Programming and Scripting

How to activate Korn Shell functionnalities in Bourne Shell

Hi All I have writing a Korn Shell script to execute it on many of our servers. But some servers don't have Korn Shell installed, they use Borne Shell. Some operations like calculation don't work : cat ${file1} | tail -$((${num1}-${num2})) > ${file2} Is it possible to activate Korn Shell... (3 Replies)
Discussion started by: madmat
3 Replies

8. Shell Programming and Scripting

Bourne shell & Korn shell

Could some one tell me the difference btw Bourne shell and the Kshell? Which is more flexible and reliable in terms of portability and efficiency. When i type the following command .. $ echo $SHELL yields me /bin/sh Does this tells me that I am in Bourne shell. If yes, how can i get... (6 Replies)
Discussion started by: bobby1015
6 Replies

9. Shell Programming and Scripting

XDOLoad.sh Korn shell errors out while loading

Hi All, O/S :AIX 6.1 64 bits The following shell script errors out while loading: cat XDOLoad.sh #!/usr/bin/ksh %s_contextfile% %s_adjvaprg% oracle.apps.xdo.oa.util.XDOLoader UPLOAD -DB_USERNAME %s_apps_user% -DB_PASSWORD ${1} -JDBC_CONNECTION... (8 Replies)
Discussion started by: a1_win
8 Replies

10. Shell Programming and Scripting

New to korn shell

I am new to korn shell and slowly learning. Is there a way to have a parent script prompt for input and then execute a child script and return the output then move forward and ask for more input and then execute the next child script? I think the answer is no but thought i would ask. (2 Replies)
Discussion started by: cptkirkh
2 Replies
asadmin-multimode(1AS)													    asadmin-multimode(1AS)

asadmin-multimode, multimode - allows you to execute multiple commands while preserving environment settings and remaining in the asadmin utility SYNOPSIS
multimode [--file filename] [--printprompt=true] [--encoding encode] [--terse=false] [--echo=false] Use multimode to process the asadmin commands. The command-line interface will prompt you for a command, execute that command, display the results of the command, and then prompt you for the next command. Additionally, all the asadmin option names set in this mode are used for all the subsequent commands. You can set your environment and run commands until you exit multimode by typing "exit" or "quit." You can also provide commands by passing a previously prepared list of commands from a file or standard input (pipe). You can invoke multimode from within a multimode session; once you exit the second multimode environment, you return to your original multimode environment. This command is supported in local mode only. --file reads the commands as defined in the file. --printprompt allows the printing of asadmin prompt after each command is executed. Set this option to false when the commands are piped or redirected from the standard input or file. By default the option is set to true. --encoding specifies the locale for the file to be decoded. --terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well- formatted data for consumption by a script. Default is false. --echo setting to true will echo the command line statement on to the standard output. Default is false. Example 1: Using multimode to execute multiple commands example% asadmin multimode --file commands_file.txt Where: example% is the system prompt. The multimode settings are executed from the commands_file.txt file. EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-export(1AS), asadmin-unset(1AS) J2EE 1.4 SDK March 2004 asadmin-multimode(1AS)

Featured Tech Videos

All times are GMT -4. The time now is 05:19 PM.
Unix & Linux Forums Content Copyright 1993-2019. All Rights Reserved.
Privacy Policy