Syntax error on variable assignment


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Syntax error on variable assignment
# 1  
Old 11-27-2008
Syntax error on variable assignment

Hello all,

I have "inherited" a Korn shell script I'm supposed to maintain, and running a "sh -n" on it, I got this syntax error:

script.sh: syntax error at line 63: `OB_DEVICE=$' unexpected

The line in cause is the first occurence of the usage of perl one-liners. The whole line:

OB_DEVICE=$(perl -e '$res =`obtool lsdev`; if ($res =~ /drive[\s]+([\w]+)/) { print $1; exit }')

I have tried to figure out what is exactly the syntax error here (because the variable assignment is correct!), I want to clean up the script.

Could somebody help me out?

Thank you,
Adrian
# 2  
Old 11-27-2008
There is nothing wrong with the syntax. What shell and version are you using?
# 3  
Old 11-27-2008
The script is written in ksh, and the version I found out with "set -o emacs" and then "Ctrl-V" is Version M-11/16/88i

Is this the 1988 version of the Korn shell?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash function using variable in it syntax error

The below bash function uses multiple variables CODING, SAMPLE, SURVEY, andvariant in it. The user selects the cap function and details are displayed on the screen using the $SURVEY variable, the directory is changed to $SAMPLE and the samples.txt is opened so the user can select the sample to... (6 Replies)
Discussion started by: cmccabe
6 Replies

2. Shell Programming and Scripting

Variable Assignment

Hi I am facing a problem. export local_folder=/opt/app/ cd /opt/app/abc/ abcversion="abc*" (abcga5 is inside /opt/app/abc/) echo $abcversion (it echoes the correct version as abcga5 ) Now when I reuse the value of abcversion for a below path: export... (6 Replies)
Discussion started by: ankur328
6 Replies

3. Shell Programming and Scripting

Same Variable Assignment

Hi I have a strange problem: In my shell script I am performing a copy task: . prop.txt cp -r $dir/ $dir/archive $dir is fetched from a property file (prop.txt) which stores its value dir=/opt/data Now the problem is another dir1 comes into picture. I only want to add... (1 Reply)
Discussion started by: ankur328
1 Replies

4. Shell Programming and Scripting

Which assignment syntax to use when?

Hi, Lately, I have seen 2-3 variable assignment commands - set, setenv, export. What is the difference between them? Which one to use when? Really appreciate for the help... regards, juzz4fun (3 Replies)
Discussion started by: juzz4fun
3 Replies

5. Shell Programming and Scripting

Variable syntax error in $?

hi all , i just tried to take the status of previous command inside the script using echo $?. It throws me a variable syntax error , but when i use echo $? as an individual command it works perfectly . can anyone Please tell me why am getting a variable syntax error when i use echo $?... (7 Replies)
Discussion started by: Rahul619
7 Replies

6. Shell Programming and Scripting

Syntax error: Bad for loop variable

I'm getting an error while running this script. Need help. set -x verbose #echo on clear #clear the screen USERNAME="bbb" PASSWORD="password" SERVER="192.168.1.100" WAIT_TIME=300 FILE_PATH="/home/users/xxx/MMM" # local directory to pickup *.dat file REMOTE_PATH="/Drop_off/xxx/yyy" #... (17 Replies)
Discussion started by: clgz2002
17 Replies

7. Shell Programming and Scripting

Help with variable assignment

Hi, In AIX I have a variable with , (coma) separated values assigned to it like shown below var1=apple,boy,chris i want to convert this to var1='apple','boy','chris' the number of values assigned to var1 might change and it could be from 1 to n any suggestions please? (3 Replies)
Discussion started by: rahul9909
3 Replies

8. Shell Programming and Scripting

Syntax error: Bad for loop variable

Hi Can any one help, I'm trying to run a script that beeps out the ip address from the PC internal speaker with the following script. It keeps throwing the error "Syntax error: Bad for loop variable" on line 16. I know its picking up the IP ADDRESS correctly. Any ideas on whats wrong. I'm... (3 Replies)
Discussion started by: dman
3 Replies

9. Shell Programming and Scripting

substituted variable assignment

I try to run this script, however, it gives an exception in line 3. How do I do an assignment to a substituted variable? #!/bin/bash name=fruit ext_$(eval echo ${name})=apple tmp=ext_$(eval echo ${name}) if ]; then echo "apple" elif ]; then echo "orange" fi echo ${!tmp} Error... (2 Replies)
Discussion started by: angelokh
2 Replies

10. UNIX for Dummies Questions & Answers

@ in a variable assignment

Hello Everybody, Does anyone know what the @ symbol means in a csh script, if used with a variable assignment as below @ line = 1 why not just use.... set line=1 Many thanks rkap (1 Reply)
Discussion started by: rkap
1 Replies
Login or Register to Ask a Question