operand expected (error token is "<")


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting operand expected (error token is "<")
# 1  
Old 05-23-2011
operand expected (error token is "<")

Hi, i am getting error from below script.

Code:
Error:  s1.sh: line 19: ((: j<: syntax error: operand expected (error token is "<")

Code:
#!/bin/bash

str=$(ps -eaf | grep smon | grep -v grep | awk ' {print $8}' | cut -c10-18)

i=1

while [ 1 ]
do
        temp=`echo $str|awk '{print $"'$i'"}'`
        if [ "$temp" = "" ]
        then
                break
        fi
        eval "var_$i"=$temp
        i=`expr $i + 1`

done

for ((j=1;j<$i;j++))
do
     export ORACLE_SID='$'var_$j
     source $HOME/.bash_profile
     $ORACLE_HOME/bin/sqlplus / as sysdba << EOF
     spool '/u02/lak/s1.txt' append
     select username from all_users;
     spool off;
EOF

done



str=" TEST LAK"

Thanks
Lak.

Last edited by pludi; 05-23-2011 at 10:32 AM..
# 2  
Old 05-23-2011
what is value of $i ? it can be null ?
# 3  
Old 05-23-2011
no, check it in While loop, first it is assigned to 1 and incremented in while loop according to input of str.
# 4  
Old 05-23-2011
can you write to output
Code:
str=$(ps -eaf | grep smon | grep -v grep | awk ' {print $8}' | cut -c10-18)

# 5  
Old 05-23-2011
i 've already written,

str="TEST LAK";
# 6  
Old 05-23-2011
you use to source .bash_profile (it goes ~/bashrc and also it goes /etc/bashrc )

your answer is below Smilie
Code:
$ grep -H 'unset i' /etc/bashrc
/etc/bashrc:    unset i

therefore your $i --> NULL and for loop fails

regards
ygemici
# 7  
Old 05-24-2011
okey fine. what can i add to my code to successful execution of my script.

---------- Post updated at 03:23 PM ---------- Previous update was at 10:03 AM ----------

any one their to help me out of this problem.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Compiler error "lvalue required as left operand of assignment"

1. After trying to compile code error is given Lvalue required as left operand of assignment. 2. Relevant commands, code, scripts, algorithms: if , else if 3. The attempts at a solution (include all code and scripts): /* File: incircles.cpp Created by: James Selhorst ... (2 Replies)
Discussion started by: c++newb
2 Replies

2. Shell Programming and Scripting

Syntax error near unexpected token `"Hit <ENTER> to continue:"'

the below code will search attr string inside makefile under the modelno on given path. echo "Enter model no for searching string inside makefile" read inputs2 #find /pools/home_unix/sapte/work/models/model/$inputs2 -name "makefile" | xargs grep "attr" \; #;;I am getting below error.... (7 Replies)
Discussion started by: lathigara
7 Replies

3. UNIX for Dummies Questions & Answers

redirect for "[: : integer expression expected" error

Hi, I read in this forum that for "https://www.unix.com/shell-programming-scripting/156008-integer-expression-expected-regular-expression.html thanks! (7 Replies)
Discussion started by: Vijay81
7 Replies

4. Programming

"lvalue required as left operand of assignment" error in C

Hey all. I've been working on some fun with C and decided to write a Rock Paper Scissors game. The problem is, that when I try to compile the file, it gives "lvalue required as left operand of assignment" error. The error line is here: for ((point1=0 && point2=0); ((point1=3) || (point2=3));... (4 Replies)
Discussion started by: drouzzin
4 Replies

5. UNIX for Dummies Questions & Answers

> 5 ")syntax error: operand expected (error token is " error

im kinda new to shell scripting so i need some help i try to run this script and get the error code > 5 ")syntax error: operand expected (error token is " the code for the script is #!/bin/sh # # script to see if the given value is correct # # Define errors ER_AF=86 # Var is... (4 Replies)
Discussion started by: metal005
4 Replies

6. Fedora

"integer expression expected" error with drive space monitoring script

Hi guys, I am still kinda new to Linux. Script template I found on the net and adapted for our environment: #!/bin/sh #set -x ADMIN="admin@mydomain.com" ALERT=10 df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output; do #echo $output ... (2 Replies)
Discussion started by: wbdevilliers
2 Replies

7. Shell Programming and Scripting

error "test: [-d: unary operator expected" very confused.

Im trying to check if a series of directory exists and if not create them, and am having issues. All the instances of test return with the error "test: #!/bin/bash location_Parent=~/Documents/sight_of_sound location_IMG=~/Documents/Sight_of_sound/IMG location_AUD=~/Documents/Sight_of_sound/AUD... (4 Replies)
Discussion started by: orionrush
4 Replies

8. Shell Programming and Scripting

error "integer expression expected" when selecting values

dear members, I am having some difficulties with an automation script that I am writing. We have equipments deployed over our network that generate status messages and I was trying an automated method to collect all information. I did a expect script that telnet all devices, logs, asks for... (4 Replies)
Discussion started by: jorlando
4 Replies

9. UNIX for Dummies Questions & Answers

"test: argument expected" error

Hi, No need to say I'm new to unix shell scripting. I have a very simple script that goes this way: for datos in `ls -rt $UNXLOG/26-Jan*` do export arch=`echo $datos |cut -d, -f1` if then export linea1=`grep Debut ${arch}` export horatot=`echo $linea1 |cut -d' ' -f5` ... (7 Replies)
Discussion started by: mvalonso
7 Replies

10. Solaris

"syntax error near unexpected token `fi' "

one of my script as follows HOME=/apps/logs mv $HOME/cron.log $HOME/cron.log.`date +%Y-%m-%d` touch $HOME/cron.log fi i am getting error as follows on the last line we are getting ... "syntax error near unexpected token `fi' " please suggest.... (4 Replies)
Discussion started by: GIC1986
4 Replies
Login or Register to Ask a Question