operand expected (error token is "<")


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting operand expected (error token is "<")
# 8  
Old 05-24-2011
Hi,
Just rename $i to $iamnoti for example.
# 9  
Old 05-24-2011
It solved. But when I am storing var_$iamnoti its just storing as var_1,var2. not real values

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
# 10  
Old 05-24-2011
Please use [CODE] tags.
# 11  
Old 05-24-2011
sorry,

Code:
#!/bin/bash

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

inc=1

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

done

for ((j=1;j<$inc;j++))
do
     ORACLE_SID='$'var_$j
     export ORACLE_SID
     echo $ORACLE_SID
     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


Last edited by Franklin52; 05-24-2011 at 12:53 PM..
# 12  
Old 05-24-2011
The closing is [/CODE] . . .

Try adding this
Code:
eval ORACLE_ID='$'var_$j

# 13  
Old 05-24-2011
lots of thanks Chirel Smilie. atlast, my script working fine without Errors. Smilie
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