Solved

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

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Linux Copy Command - All Files inc Directory 1 56
How to enable sync between two yum repo? 1 39
bash file 10 49
UNIX Script. Send email if failure 8 32
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
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…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.

840 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