Variable not found error


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Variable not found error
# 1  
Old 10-26-2012
Variable not found error

Hi, I get a "FILEPATH: not found" error on the 3rd line and the line where it is within the case. Any idea as to why I'm getting this error time and time again?

Oh and FILEPATH will store the directory of the file.

I appreciate any help!

Code:
IAM=`basename $0`
RC=0
FILEPATH = ""
##################################################################
# Setup the common variables and give access to common functions #
##################################################################
if [[ $COMMON_HOME != "" ]]
then
   . $COMMON_HOME/scripts/PACE_common.ksh
   RC=$?
else
   echo "COMMON_HOME environmental not set--`/usr/bin/basename $0` ending run."
   echo "Processing discontinued."
   RC=$PACE_UNAVAIL
   exit $RC
fi


##############################################################
# Collect the allow parameters and trap the unknowned	     #
##############################################################
while getopts :s:h opt;
do
case $opt in
s) FILEPATH = "$OPTARG";;

h) log_data $IAM "Displaying usage screen."
display_usage
exit 0;;

     *) RC=$UNK_PARM
        log_data $IAM "E-$RC" "Invalid parameter received.";;
esac
done

#########################################################################
#Processsing of the -s parameter                                        #
#########################################################################

if [[ ! -e $FILEPATH ]]
then
     RC=$FILE_NOTFOUND
     log_data $IAM "Input file not found"
     exit $RC
if [[ $FILEPATH != "*.txt*" ]]
then
	RC=$INVALID_FILE
	log_data $IAM "Invalid file received."
	exit $RC
fi

awk '{printf $0; for (i=1;i<=19;i++) printf $3; print "\n"}' $FILEPATH > inputfile.txt

awk -v OFS="," '{gsub("-", " -"); print $1,$2,$3+0,$4+0}' OFMT='%.2f' $FILEPATH > tempinputfile.txt

awk '{printf $0 " "; for (i=1;i<=38;i++) printf $4 " "; print "\n"}' tempinputfile.txt > inputfile.csv

rm -f tempinputfile.txt



function display_usage
{
   echo ""
   echo "Usage is:"
   echo "expandInputFile.ksh -s <source path> "
   echo ""
   echo "Parameter requirements:"
   echo "-s <source path>:   This is a required parameter that will accept the"
   echo "                    given path of the input file. It must be in .txt"
   echo "		     format"
}

# 2  
Old 10-26-2012
When setting a shell variable you can't have spaces around the "=". You can in awk; but not in shell.
This User Gave Thanks to Don Cragun For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Error : command not found

Hi , I am an Oracle developer. trying to write a shell script to compile all the forms that are modified in last 1 hour. Script Body cat cmp.sh for f in `find ./*fmb* -mmin -60`; do "`frmcmp_batch.sh userid=ba/ba@testdb batch=yes module=$f module_type=form compile_all=yes... (2 Replies)
Discussion started by: imrandec85
2 Replies

2. Shell Programming and Scripting

Variable not found error in while loop

I am unable to use the value of a variable. while ] do LstFldDataPart =`head -n "$LstFldDataPartCntr" "${FeedFileDir}/${FeedFileBadRecs}" | tail -1 | tr -d '\n'` echo $LstFldDataPart JndLstFldDataPart="${JndLstFldDataPart}${LstFldDataPart}" LstFldDataPartCntr=... (3 Replies)
Discussion started by: TomG
3 Replies

3. Shell Programming and Scripting

Command not found error 'then'

Could you let me know if my path is having bourne bash echo $PATH /u01/app/oracle/product/10.2.0/db_1/bin:/usr/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/oracle/bin $ which bash /bin/bash $ which ls alias ls='ls --color=tty' /bin/ls Below is... (3 Replies)
Discussion started by: csguna6
3 Replies

4. UNIX for Dummies Questions & Answers

Command not found error

$ cat nu who | wc -l $ ls -l nu -rwxr-x--- 1 _ _ 11 Jul 30 12:37 nu //the nu is displayed in green color $ nu bash: nu: command not found I am using a book from 1986 on Unix System V, Release 3, and the Unix system I am connecting to is from my college. Below is the notes from the book:... (4 Replies)
Discussion started by: chip
4 Replies

5. Linux

command not found error

I installed in VM the Mandriva Linux. But when I fire the make command it gives me command not found error. Seems make is not installed. I also checked in Mandriva control center and no development package is seen there. Will pls let me know how to proceed and get make and other development... (2 Replies)
Discussion started by: rupeshkp728
2 Replies

6. Shell Programming and Scripting

Variable not found error for a variable which is returned from stored procedure

can anyone please help me with this: i have written a shell script and a stored procedure which has one OUT parameter. now i want to use that out parameter as an input to the unix script but i am getting an error as variable not found. below are the unix scripts and stored procedure... ... (4 Replies)
Discussion started by: swap21783
4 Replies

7. Shell Programming and Scripting

Undefined variable and command not found

Below script cuts date part from the date entered by the user. #!/bin/csh echo 'Enter date in the format dd/mm/yyyy' read DATE DD=`echo $DATE | cut -c1-2` echo $DD; when debug with -x option , it works perfectly but without -x doesnot.:confused: $ sh -x unix_12.sh + echo Enter... (2 Replies)
Discussion started by: hiten.r.chauhan
2 Replies

8. UNIX for Dummies Questions & Answers

Loop on array variable returning error: 0 not found

I'm guessing i have a syntax error. I'm not sure it get's past the the while condition. I get an error 0 not found. Simple loop not sure what I'm doing wrong. #!/usr/bin/ksh set -A MtPtArray /u03 /u06 tUbound=${#MtPtArray } echo $tUbound i=0 while ($i -lt $tUbound) do print... (4 Replies)
Discussion started by: KME
4 Replies

9. Shell Programming and Scripting

not found error

Hi I have to move data to a file based on the valuies of first three characters in a file I am using the following script FIN=$LOC/TEST.TXT FEEDFILE=$LOC/TUE_GROSSJE.TXT #Read the file while read FDROW do FEEDROW=$FDROW; DTYPE=`echo $FEEDROW |cut -c 1-3` if ; then $FEEDROW... (4 Replies)
Discussion started by: gander_ss
4 Replies

10. Shell Programming and Scripting

variable not found with loop?

I cannot seem to pass the value of the variable assigned in the "else" statment below to an "if" statement outside of the loop. When I debug using "set -x", I find that the value of "$A" is empty. Is there something I'm missing here? Code is below: do if ] then echo "Good Match"... (2 Replies)
Discussion started by: douknownam
2 Replies
Login or Register to Ask a Question