I am getting strange message when run borne shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting I am getting strange message when run borne shell script
# 1  
Old 03-06-2017
I am getting strange message when run borne shell script

I have a code:
Code:
 if [ -d ${COOLDIR}/cool_${Today}/daily ]
then#{ process daily files
 for file in *_${Today}*.csv *_${Today}*.txt
do
        if [ -f "LET_daily_trans_${Today}.csv" ] || [ -f "LET_daily_trans_345_${Today}.csv" ]
        then
                echo "This file will be processed in separate script"
                continue
        fi
         if [ "${prefix}" = "MBSE_daily_trans_sum_" ];then
                                sftp_name=MBSEDTRNSUM
                        elif [ "${prefix}" = "MBSE_daily_trans_badcpn_" ];then
                                sftp_name=MBSEDTRNBADCPN
                        elif [ "${prefix}" = "MBSE_daily_trans_sum_345_" ];then
                                sftp_name=MBSEDTRNSUM345
                        elif [ "${prefix}" = "MBSE_daily_trans_badcpn_345_" ];then
                                sftp_name=MBSEDTRNBADCPN345
                        elif [ "${prefix}" = "MBSE_daily_trans_" ];then
                                sftp_name=MBSEDAYTRNS
                        elif [ "${prefix}" = "MBSE_daily_trans_345_" ];then
                                sftp_name=MBSEDAYTRNS345
                        else
                                echo "Unnkowned prefix name ${prefix}"
           fi
           if [ "${ext}" != "txt" ];then
                     do something
           fi

 done
 
for file in *.${Today}*.csv *.${Today}*.txt
do
  if [ -f daily_tba_position.${Today} ] || [ -f daily_pool_position.${Today} ] || [ -f LET.${Today} ];then
                echo "files were processed by the brkvol_day_sftp_ondemand.sh script"
                continue
  fi
 if [ "${ext}" != "txt" ]
  then
     do something
               if [ "${fldt}" = "-" ];then
                          do something
               else
                  do something
               fi
        do something
    else
          do something
    fi
 if [ "${ext}" != "txt" ];then
          do something                     
                                
 else
           do something                     
  fi

 done
 fi #} finished to process daily files line 384

When I try to run the borne shell script I am getting message
Code:
 ./sftp_ondemand.sh[95]: syntax error at line 384 : `fi' unexpected

Could you please let me know why?

Thanks for contribution

Last edited by digioleg54; 03-06-2017 at 07:08 PM..
# 2  
Old 03-06-2017
Not knowing what a borne shell is, I suspect this
Code:
then#{ process daily files

to be the culprit. Trying to replicate the problem (like then#blalala), in bash I get
Code:
bash: syntax error near unexpected token `fi'

while in sh (dash), I get
Code:
sh: 1: Syntax error: "fi" unexpected (expecting "then")

which is way more enlightening than the error message that you received from your shell.


By the way, proper and consistent indenting always helps to reveal problems in code blocks due to missing / unclosed keywords or tokens (if - fi, case - esac, do - done, "(" - ")", etc. )

Last edited by RudiC; 03-06-2017 at 07:35 PM..
This User Gave Thanks to RudiC For This Post:
# 3  
Old 03-06-2017
That is perfectly works. It is bourne shell , Sorry
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies

2. Shell Programming and Scripting

Shell script to run command + compare values and post a warning message.

Hi all, I am trying to create shell script to run command then compare values with rule set for every 5 seconds and post a warning message if the compared value meet the rules. -the script is related to Oracle/Sun product messaging server 6.2 1) command that need to be run to gather... (2 Replies)
Discussion started by: Mr_47
2 Replies

3. UNIX for Dummies Questions & Answers

borne shell script

I need anwser to this qestion! I havewirte a script that provides line numbered contents of a file which must make use of the following control structures files Command line arguments I am a complete new commer to unix and bourne shell scripting can any one help (1 Reply)
Discussion started by: migg-21
1 Replies

4. Shell Programming and Scripting

Documenattion on Borne And C shell programming

Hi experts, I am new bee in unix programming. How to differenciate a Borne and C shell programming. Can i write a C shell syntax in Borne again shell. Please send me the good links on Borne and Cshell programming . Any help in this regard will be highly appreciated. Regards, Azaz. (3 Replies)
Discussion started by: azazalis
3 Replies

5. Shell Programming and Scripting

UNIX Find command in Borne Shell

I need to perform two separate commands as part of the -exec section of a find command. Is this possible? (1 Reply)
Discussion started by: marshaferry
1 Replies

6. UNIX for Dummies Questions & Answers

Need Help With My First Borne Shell Program

I'm working on writing my very first borne shell program and I need some help. I think I'm pretty close to having this correct but I may be off. I think my actual program is coded correctly but the commands I use within it I think are what's throwing it off? **Purpose of the program: To... (3 Replies)
Discussion started by: FuzzyNips
3 Replies

7. Shell Programming and Scripting

ed strange error message

When I start ed as regular user, following message is displayed: $ed ERROR: tempnam failed: Permission denied $ I think, following error produced in vi when search results from previous error: No previous regular expression Setting TMPDIR variable cause no effect. As root all works... (6 Replies)
Discussion started by: frenki
6 Replies

8. Shell Programming and Scripting

Can there be multi-dimensional variable arrays in borne shell?

Hello - I've serached the web but can't find much on array script variables (except that C-shell variables are arrays!) I'm trying to form a 2-D string array: (this is what I want, but in java) String list = { {"one", "two"}, {"three"} }; I know this is a 1-D string array shell... (4 Replies)
Discussion started by: jparker
4 Replies

9. UNIX for Dummies Questions & Answers

Modifying from borne shell to C shell

Just want to know a few conversion tricks. in Borne Shell, I have the line: if test -s testmap then ... fi ## testmap is a filename and I wanna test whether it exists ## then do whatever How can I convert that to C Shell? I've tried: if (test -s testmap) then ... endif but it... (3 Replies)
Discussion started by: zenkisoft
3 Replies
Login or Register to Ask a Question