Solved

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

Posted on 2014-01-29
4
449 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SIP Trunk provider 20 93
Notice: Undefined variable 5 54
Edit linux file using python 4 20
Auto channel for WiFi (Access Point) 3 48
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now