Solved

Linux - command if ($PARAM1 -gt 0 ); then or if [$PARAM1 -gt 0]; then - produce error

Posted on 2014-01-29
4
457 Views
Last Modified: 2014-01-29
Hi experts.
Line 14 is giving me error.


[oracle@hpescs1 /home/oracle/dba/scripts/ARCHIVES]# bash -vx verifica_archives.sh
ORACLE_HOME=/oracle/orabase/ora11g
+ ORACLE_HOME=/oracle/orabase/ora11g
export ORACLE_HOME
+ export ORACLE_HOME
ORACLE_SID=SCSD1
+ ORACLE_SID=SCSD1
export ORACLE_SID
+ export ORACLE_SID
PATH=/oracle/orabase/ora11g:/oracle/orabase/ora11g/bin:/oracle/orabase/ora11g/OPatch:/oracle/orabase/ora11g/lib:/usr/lib:/usr/openv/netbackup/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/sbin::/usr/ccs/bin
+ PATH=/oracle/orabase/ora11g:/oracle/orabase/ora11g/bin:/oracle/orabase/ora11g/OPatch:/oracle/orabase/ora11g/lib:/usr/lib:/usr/openv/netbackup/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/sbin::/usr/ccs/bin
export PATH
+ export PATH
sqlplus /nolog<<EOF
connect /as sysdba
@/home/oracle/dba/scripts/ARCHIVES/verifica.sql
EOF
+ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Wed Jan 29 10:31:19 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

SQL> Connected.
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
awk '{if ($1 < 400) print "archive"} ' /home/oracle/dba/scripts/ARCHIVES/textfile.lst > /home/oracle/dba/scripts/ARCHIVES/archives_space_tight
+ awk '{if ($1 < 400) print "archive"} ' /home/oracle/dba/scripts/ARCHIVES/textfile.lst
log=/home/oracle/dba/scripts/ARCHIVES/archives_space_tight
+ log=/home/oracle/dba/scripts/ARCHIVES/archives_space_tight
PARAM1=$(wc -l < /home/oracle/dba/scripts/ARCHIVES/archives_space_tight)
wc -l < /home/oracle/dba/scripts/ARCHIVES/archives_space_tight
++ wc -l
+ PARAM1=1
if ($PARAM1 -gt 0 ); then
/home/oracle/dba/scripts/ARCHIVES/RMAN_ARCH_DELETE.sh
fi
+ 1 -gt 0
verifica_archives.sh: line 14: 1: command not found
0
Comment
Question by:LindaC
  • 2
  • 2
4 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 500 total points
ID: 39817812
Try
if  [ $PARAM1 -gt 0 ]; then

Open in new window


or

if  [[ $PARAM1  > 0  ]]; then

Open in new window


or

if (( PARAM1 > 0 )); then

Open in new window


Please notice spaces after [ and before ]
0
 
LVL 8

Author Closing Comment

by:LindaC
ID: 39817821
Thank you!
0
 
LVL 31

Expert Comment

by:farzanj
ID: 39817825
You are welcome.

Also note that $ in the last expression is optional
0
 
LVL 8

Author Comment

by:LindaC
ID: 39817827
Thank you.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AWS - HAProxy- KeepAlived 5 43
Setting up static IP - Ubuntu server 16.04 12 65
Linux VM 6 90
how to install java on RHEL image on EC2 4 30
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question