Sponsored Content
Full Discussion: Error when executing script
Operating Systems Linux Red Hat Error when executing script Post 303001629 by anaigini45 on Wednesday 9th of August 2017 06:24:47 AM
Old 08-09-2017
Thank you so much for all the comments and suggestions.

I have now managed to compile the whole script, but still needs a bit more tweaking as there are few more errors.

Part of my script does this :

Code:
new=1
for f in `find . -name '*.filtered' | sort -r`; do                                                                  
> eximstats -nr "$f" > "eximstats_day"$new"_"$eximBC01.txt";
> eximstats -xls -nr  "$f" > "eximstats_day"$new"_"BC01.xls";
> ((new++));
> done

This returns errors like this :

Code:
bash: eximstats_day1_01082017.txt;
eximstats -xls -nr  ./mainlog.7.filtered > eximstats_day1_BC01.xls: No such file or directory
bash: eximstats_day2_01082017.txt;
eximstats -xls -nr  ./mainlog.6.filtered > eximstats_day2_BC01.xls: No such file or directory
bash: eximstats_day3_01082017.txt;
eximstats -xls -nr  ./mainlog.5.filtered > eximstats_day3_BC01.xls: No such file or directory
bash: eximstats_day4_01082017.txt;
eximstats -xls -nr  ./mainlog.4.filtered > eximstats_day4_BC01.xls: No such file or directory
bash: eximstats_day5_01082017.txt;
eximstats -xls -nr  ./mainlog.3.filtered > eximstats_day5_BC01.xls: No such file or directory
bash: eximstats_day6_01082017.txt;
eximstats -xls -nr  ./mainlog.2.filtered > eximstats_day6_BC01.xls: No such file or directory

However, when I execute the code directly on the terminal, there is no error (without the for loop) :

Code:
# eximstats -nr  mainlog.7.filtered > eximstats_day1_01082017.txt
# eximstats -xls -nr  mainlog.7.filtered > eximstats_day1_01082017.xls

Is there something wrong with the syntax?

---------- Post updated 08-09-17 at 06:24 PM ---------- Previous update was 08-08-17 at 07:19 PM ----------

I found out that the error was variable substitution. I corrected the code like this, and it worked properly :

Code:
new=1
for f in `find . -name '*.filtered' | sort -r`; do
       eximstats -nr "$f" > eximstats_day"$new"_"$eximBC07".txt;
       eximstats -xls -nr  "$f" > eximstats_day"$new"_"$eximBC07".xls;
       ((new++));
done

However, I have another part of the script that has this line :

Code:
eximstats -merge eximstats_day*.txt > "eximstats.consolidated_$MONTH$YEAR.txt"

I did not put the "" for the $MONTH$YEAR, but it still produced the output I wanted. Why is this?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

error while executing the script

Hello I am executing the following script nawk 'NR == 1 || substr($0,63,5) ~ /H... / && \ _++ == 2 { fn && close(fn); fn = "part_" ++c; _ = 1 } { print > fn }' sample.dat When i execute as it is it is executing fine. but when i execute the whole script as a single line like below ... (2 Replies)
Discussion started by: dsdev_123
2 Replies

2. Shell Programming and Scripting

Error while executing a script

My script is as below : #!/bin/sh for line in `cat Results.txt` do FEILD1=`echo $line |awk -F"|" '{print $1}'` FEILD2=`echo $line |awk -F"|" '{print $2}'` FEILD3=`echo $line |awk -F"|" '{print $3}'` FEILD4=`echo $line |awk -F"|" '{print $4}'` echo "$FEILD1 $FIELD2 $FIELD3 $FIELD4" done ... (15 Replies)
Discussion started by: shwetainnani
15 Replies

3. Shell Programming and Scripting

Error while executing the below script

I am executing the below in telnet #!/usr/bin/ksh File1=simple.txt # The file to check LogFile=simple.log # The log file DelayMax=30 # Timeout delay Tolerance=2 # BEGIN ############################## while true do StampNow=$(date +%s)/60 # stamp in minutes ... (3 Replies)
Discussion started by: chinniforu2003
3 Replies

4. UNIX for Dummies Questions & Answers

Error Executing the script.

Hi , I m getting an error after executing the script. My script. Script is used to find out the date on 8 different machines(mentioned in SERVERNAMES file). I have added public key to avoid ssh password and ssh without password working fine. #!/bin/sh fn_VMFind() { Date=`ssh -t... (5 Replies)
Discussion started by: pinga123
5 Replies

5. Shell Programming and Scripting

Error while executing a script

Hi Please assist. Im getting an error while execuing the script name d "cdsnd.basel.cd_new " as siiadm user. Thanks. siiadm> ls -l total 64 -rwxr-xr-x 1 siiadm sboadm 1004 Sep 17 2008 cdsnd.basel.cd -rwxr-xr-x 1 siiadm sapsys 998 Nov 16 09:14 cdsnd.basel.cd_new... (1 Reply)
Discussion started by: samsungsamsung
1 Replies

6. Shell Programming and Scripting

getting the error 'not found' while executing the script

Hi, I am not able to figure out what the problem is: getting the following error sqltst.sh: 1: not found here is the script #!/bin/sh . /home/dev1/.profile . /home/dev1/.infenv `sqlplus -s $REPDB_LOGON << EOF SET SERVEROUT ON SET FEEDBACK OFF SET HEADING OFF SET TRIMSPOOL... (4 Replies)
Discussion started by: svajhala
4 Replies

7. Shell Programming and Scripting

Error executing script

Please delete de thread. Thanks. (10 Replies)
Discussion started by: Rodrih92
10 Replies

8. Linux

Libssh2 error while executing script

hi all, i am getting libssh2 error while executing script in RHEL 6, when i locate that file its not there below is the ouput of this # locate libssh2_agent_init # cat /etc/issue Red Hat Enterprise Linux Server release 6.1 (Santiago) Kernel \r on an \m how do i resolve this issue, i... (1 Reply)
Discussion started by: muzaffar.k
1 Replies

9. UNIX for Dummies Questions & Answers

Error executing the script

I have the following script test.sh owned by dwdev account and group dwdev, the permissions on the script are as follows. -rw-r-x--- 1 dwdev dwdev 279 Sep 17 13:19 test.sh Groups: cat /etc/group | grep dwdev dwdev:x:704:dwdev dwgroup:x:725:dwdev writers:x:726:dwdev User: cat /etc/passwd |... (3 Replies)
Discussion started by: Ariean
3 Replies

10. Shell Programming and Scripting

Gettting error while executing script

getting error as below while executing script in linux. OS version: Linux VGP-3GPSDB-LX 3.10.0-514.el7.x86_64 #1 SMP Wed Oct 19 11:24:13 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux ./imxtract.sh: line 395: unexpected EOF while looking for matching ``' ./imxtract.sh: line 402: syntax error:... (1 Reply)
Discussion started by: Riverstone
1 Replies
burp_ca(8)							      burp_ca								burp_ca(8)

NAME
burp_ca - program for generating certificates for use with burp SYNOPSIS
burp_ca [options] A script for generating certificates for use with burp. This script comes with the burp backup and restore package, and was contributed by Patrick Koppen. OPTIONS
-h|--help show help -i|--init inititalize CA -k|--key generate new key -r|--request generate certificate sign request -s|--sign sign csr (use --ca <ca> and --name <name>) --batch do not prompt for anything --revoke <number> revoke certificate with serial number --crl generate certificate revoke list -d|--dir <dir> ca output dir (default: /etc/burp/CA) -c|--config config file (default: /etc/burp/CA.cnf) -n|--name name (default: builder) -D|--days valid days for certificate (default in config file) --ca_days valid days for CA certificate (default: 3650) -S|--size key size (default: 2048) -a|--ca ca name if different from name -f|--dhfile <path> generate a new dhfile BUGS
If you find bugs, please report them to the email list. See the website <http://burp.grke.net/> for details. AUTHOR
The main author of Burp is Graham Keeling. COPYRIGHT
See the LICENCE file included with the source distribution. February 10, 2012 burp_ca(8)
All times are GMT -4. The time now is 02:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy