Solved

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

Posted on 2014-01-29
4
463 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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