Sponsored Content
Top Forums Shell Programming and Scripting Shell script simple if then :: fi missing ] Post 302563130 by Astrocloud on Monday 10th of October 2011 07:26:54 AM
Old 10-10-2011
Thanks but there is another cryptic error.
Code:
#! /bin/sh
set -x
if [ -r /home/dudemgnt/public_html/fileserver/Checks/Daily/RefundChecksDaily*.txt ]; then
rm /home/dudemgnt/public_html/fileserver/Checks/Daily/RefundChecksDaily.csv
cat /home/dudemgnt/public_html/fileserver/Checks/Daily/RefundChecksDaily*.txt|sed  's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > /home/dudemgnt/public_html/fileserver/Checks/Daily/RefundChecksDaily.csv
perl -ne 'chomp;
            m|^(.*)\b(\d+)/(\d+)/(\d+)\b(.*)$|;
            printf ("%s%04d-%02d-%02d%s\n", $1,$4,$2,$3,$5)
           ' /home/dudemgnt/public_html/fileserver/Checks/Daily/RefundChecksDaily.csv > /home/dudemgnt/public_html/fileserver/Checks/Daily/RefundChecksDaily.csv
mysql -ududemgnt -phi_there665 dudemgnt_patCopy -B < /home/dudemgnt/mysql_scripts1234/Import_FTPChecks.sql 
fi

if [ -r /home/dudemgnt/public_html/fileserver/CallLog/Daily/CallLogDaily*.txt ]; then
rm /home/dudemgnt/public_html/fileserver/CallLog/Daily/CallLogDaily.csv
cat /home/dudemgnt/public_html/fileserver/CallLog/Daily/CallLogDaily*.txt|sed  's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > /home/dudemgnt/public_html/fileserver/CallLog/Daily/CallLogDaily.csv
perl -ne 'chomp;
            m|^(.*)\b(\d+)/(\d+)/(\d+)\b(.*)$|;
            printf ("%s%04d-%02d-%02d%s\n", $1,$4,$2,$3,$5)
           ' /home/dudemgnt/public_html/fileserver/CallLog/Daily/CallLogDaily.csv > /home/dudemgnt/public_html/fileserver/CallLog/Daily/CallLogDaily.csv
mysql -ududemgnt -phi_there665 dudemgnt_patCopy -B < /home/dudemgnt/mysql_scripts1234/CallLogDaily.sql 
fi

if [ -r /home/dudemgnt/public_html/fileserver/BW/Daily/DataBw*.txt ]; then
rm /home/dudemgnt/public_html/fileserver/BW/Daily/DataBw.csv
cat /home/dudemgnt/public_html/fileserver/BW/Daily/DataBw*.txt|sed  's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > /home/dudemgnt/public_html/fileserver/BW/Daily/DataBw.csv
perl -ne 'chomp;
            m|^(.*)\b(\d+)/(\d+)/(\d+)\b(.*)$|;
            printf ("%s%04d-%02d-%02d%s\n", $1,$4,$2,$3,$5)
           ' /home/dudemgnt/public_html/fileserver/BW/Daily/DataBw.csv > /home/dudemgnt/public_html/fileserver/BW/Daily/DataBw.csv
mysql -ududemgnt -phi_there665 dudemgnt_patCopy -B < /home/dudemgnt/mysql_scripts1234/DataBw.sql 
fi

./hospitalfile_imports.sh
+ [ -r /home/dudemgnt/public_html/fileserver/Checks/Daily/RefundChecksDaily.txt /home/dudemgnt/public_html/fileserver/Checks/Daily/RefundChecksDaily012811_151423.txt ]
[: 1: /home/dudemgnt/public_html/fileserver/Checks/Daily/RefundChecksDaily.txt: unexpected operator
+ [ -r /home/dudemgnt/public_html/fileserver/CallLog/Daily/CallLogDaily*.txt ]
+ [ -r /home/dudemgnt/public_html/fileserver/BW/Daily/DataBw*.txt ]

What does the set -x do and did i place it correctly?

---------- Post updated at 07:26 AM ---------- Previous update was at 07:24 AM ----------

Intention is to load sql files from text files if necessary... the sql is nothing more than :

LOAD DATA LOCAL INFILE '/home/dudemgnt/public_html/fileserver/BW/Daily/DataBw.csv' INTO TABLE `IMPORT_DataBW_FTP` FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need a simple shell script

Hi, I am new to unix as well as shell programming. Any body can provide me a simple shell script which should copy/transfer/fetch a file(using FTP)from remote server to local system.and it should log the details when it was fetched.If there is any error,the error msg should log in log... (1 Reply)
Discussion started by: Mar1006
1 Replies

2. Shell Programming and Scripting

Please Help On Simple Shell Script

This is an assignment I have to do everyone but I was viewing the threads and I assumed that I could write this assignment simpler than what My instructor is directing.. Here is the Assignment This shell script has the following specifications: - It must be named: "printpasswd." - It must... (1 Reply)
Discussion started by: dmosheye
1 Replies

3. UNIX for Advanced & Expert Users

I need of a simple shell script

Hi, I need of a simple shell script to launch a perl script. The complet path of the script is: /export/home/x2693/project/v02/appliancemanagement.pl (2 Replies)
Discussion started by: Minguccio75
2 Replies

4. Shell Programming and Scripting

Need help in a simple shell script

Hi All I have requirement to write a shell script which would look for the userid which is logged in , and once the User id is found i would delete certain lines from a parameter file .. here is what iam using a=ps -o user | grep -v user | uniq then using an if condition and... (4 Replies)
Discussion started by: raghav1982
4 Replies

5. Shell Programming and Scripting

simple shell - how to get a parameter typed in a shell script

Hi, I am new to unix and using linux 7.2. I would like to create a script that would make it easyer for me to run my java programms. At the moment I have to type java myJavaprogram I am trying to write a script that will allow me to type something like this "myscript myJavaprogram" or maybe... (4 Replies)
Discussion started by: cmitulescu
4 Replies

6. Shell Programming and Scripting

Help with simple Shell Script

Hi , I am in need of simple shell script that has one input file containing some words Input file 1 : ****ALEX***JOHN*******VIRGIL***** CHRITINE*****FAISAL*****DON***** ****ALEX***JOHN*******VIRGIL***** CHRITINE*****FAISAL*****DON***** ****ALEX***JOHN*******VIRGIL*****... (6 Replies)
Discussion started by: kmanjuna
6 Replies

7. Shell Programming and Scripting

Simple Shell Script? Someone help?

Write a shell script which adds up 10 numbers entered by the user and displays the result to the screen. You must use the read command to obtain the numbers from the user. Im a nooby noob (2 Replies)
Discussion started by: LinuxNubBrah
2 Replies

8. Shell Programming and Scripting

Simple Shell Script! Almost Done!

Hello, I am creating a shell script and I am almost done. I have certain things I want done in the shell but don't know how to finish it properly. Here is what I am aiming to do. I am aiming to have a shell that takes at least 3 parameters. The first two are the two words to replace (the... (3 Replies)
Discussion started by: ShellsNewb
3 Replies

9. UNIX for Advanced & Expert Users

Checking missing data's sequence (shell script | UNIX command)

Dear All members, i have some trouble here, i want to ask your help. The case is: I have some data, it's like: -ABCD1234 -ABCD1235 -ABCD1237 -BCDE1111 -BCDE1112 -BCDE1114 there is some missing data's sequence (the format is: ABCD = name 1234 = sequence). I want to print the... (2 Replies)
Discussion started by: septian.tri
2 Replies

10. UNIX for Beginners Questions & Answers

Compilation error character is missing-UNIX shell script

Dear Friends, Regarding Compilation error character is missing-unix shell script I am new to unix shell script. My requirement is --I need to find out 3 files in my UBM unix directory,if any one(CMUSER) file is available means,then i need to exit from my unix script, Below is my unix... (2 Replies)
Discussion started by: Joseph2017
2 Replies
ATF-SH(1)						    BSD General Commands Manual 						 ATF-SH(1)

NAME
atf-sh [-s shell] -- interpreter for shell-based test programs SYNOPSIS
atf-sh script DESCRIPTION
atf-sh is an interpreter that runs the test program given in script after loading the atf-sh(3) library. atf-sh is not a real interpreter though: it is just a wrapper around the system-wide shell defined by ATF_SHELL. atf-sh executes the inter- preter, loads the atf-sh(3) library and then runs the script. You must consider atf-sh to be a POSIX shell by default and thus should not use any non-standard extensions. The following options are available: -s shell Specifies the shell to use instead of the value provided by ATF_SHELL. ENVIRONMENT
ATF_LIBEXECDIR Overrides the builtin directory where atf-sh is located. Should not be overridden other than for testing purposes. ATF_PKGDATADIR Overrides the builtin directory where libatf-sh.subr is located. Should not be overridden other than for testing purposes. ATF_SHELL Path to the system shell to be used in the generated scripts. Scripts must not rely on this variable being set to select a specific interpreter. EXAMPLES
Scripts using atf-sh(3) should start with: #! /usr/bin/env atf-sh Alternatively, if you want to explicitly choose a shell interpreter, you cannot rely on env(1) to find atf-sh. Instead, you have to hardcode the path to atf-sh in the script and then use the -s option afterwards as a single parameter: #! /path/to/bin/atf-sh -s/bin/bash ENVIRONMENT
ATF_SHELL Path to the system shell to be used in the generated scripts. SEE ALSO
atf-sh(3) BSD
September 27, 2014 BSD
All times are GMT -4. The time now is 11:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy