Getting this error syntax error near unexpected token `)'


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Getting this error syntax error near unexpected token `)'
# 1  
Old 03-14-2018
Getting this error syntax error near unexpected token `)'

Hi Everyone,

my script was running Ok, but suddenly it started giving this error.

Code:
./update_env_bi.sh: line 54: syntax error near unexpected token `)'
./update_env_bi.sh: line 54: `sed -i "s/PORT=[^)]*1/PORT=$2/" repository.xml'

The line 54 has this code.

Code:
sed -i "s/PORT=[^)]*1/PORT=$2/" repository.xml

$2 is the second command line argument

with above code, i am changing the port number in this line
Code:
<param name="url" value="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbhost.domain.com)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=DBSID)))"/>

what is the wrong with this line ?
Code:
sed -i "s/PORT=[^)]*1/PORT=$2/" repository.xml

---------- Post updated at 09:04 AM ---------- Previous update was at 08:48 AM ----------

i just checked it.

A " double quotes was missing in the echo command.

Its resolved now.
Thanks Bye Everyone.
Moderator's Comments:
Mod Comment Please use CODE tags (not ICODE tags) when displaying full-line and multi-line sample input, output, and code segments.

Last edited by Don Cragun; 03-14-2018 at 11:14 AM.. Reason: Change ICODE tags to CODE tags; add ICODE tags.
# 2  
Old 03-14-2018
I am guessing you intended to use extended regex. This requires that you escape characters with special meaning - like the ) character -> \)
# 3  
Old 03-15-2018
Thanks Jim,

I had missed a double quotes "in echo command, so i was getting this error. now its resolved.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Syntax error near unexpected token

Dears, While executing the below script im getting the error at line 30. Please let me know what changes to be done to fix this. test.sh: line 30: syntax error near unexpected token `done' test.sh: line 30: ` done ' #!/bin/sh # Rev. PA1 # author: eillops # date: 26-04-2018 # #... (1 Reply)
Discussion started by: Kamesh G
1 Replies

2. UNIX for Beginners Questions & Answers

Syntax error near unexpected token 'do'

Hello all, Please i have this command i used to zip different files in differents directory, but i have an error. Note that when i run the command in one directory it works fine. /X5/WORK/BGH/INV/REG/pdf/SEND/BGH12523/1/*.fo /X5/WORK/BGH/INV/REG/pdf/SEND/BGH24523/1/*.fo... (3 Replies)
Discussion started by: gillesi
3 Replies

3. Shell Programming and Scripting

Syntax error near unexpected token

Hi all, I have a simple script that doesn't work somehow. I can't seem to be spotting the cause of the malfunction. count=$((1)) for item in `cat test1.txt` printf %s `sed -n $((count))p test2.txt` > test3.txt count=$((count+1)) do something done I get ; ./why.sh: line 3:... (14 Replies)
Discussion started by: y33t
14 Replies

4. Shell Programming and Scripting

Syntax error near unexpected token `else'

Hi, I am trying to read the session log through script. But it keeps showing me some error near. I have tried everything. Even tried converting the script using sed command to remove the hidden characters(\r).But nothing seems to be working.Below is the script : #!/bin/bash cd... (6 Replies)
Discussion started by: Aryan12345
6 Replies

5. Homework & Coursework Questions

Syntax error near unexpected token 'else'

1. The problem statement, all variables and given/known data: line 37: syntax error near unexpected token 'else' line 37: ' else' the script is made to take 1 or 2 command line arguments however i get the above stated error when trying to process it. This happens with or without arguments... (6 Replies)
Discussion started by: Ren_kun
6 Replies

6. Shell Programming and Scripting

Syntax error near unexpected token `}' please help

I'm going mad not being able to get this to work. im assuming its only a simple mistake but its driving me bonkers trying to find it. Please if you can help me it would save me pulling my hair out!! Thanks #!/bin/bash -xv # #Config name="TEST Server" + name='TEST Server'... (6 Replies)
Discussion started by: Fisheh
6 Replies

7. Shell Programming and Scripting

syntax error near unexpected token `='

Hi all, This is a script which converts hex to bin. However am finding an error while executing syntax error near unexpected token `=' `($hexfile, $binfile) = @ARGV;' I am running using ./fil.pl <hexfile> <binfile> ################################################### # # this script... (3 Replies)
Discussion started by: jaango123
3 Replies

8. Shell Programming and Scripting

Syntax error near unexpected token `done'

Hi all, Here is a simple script that is working in one server and is giving a syntax error in other server. Can somebody help me ? #!/bin/bash # ftp files done < $file errors: I tried..with no success: if ; then (21 Replies)
Discussion started by: Lenora2009
21 Replies

9. Shell Programming and Scripting

Syntax error near unexpected token `('

Guys , This is an output of my script errored out for "Syntax error near unexpected token `(' " Can someone tell me whats wrong with my script. Below is my original script pasted. #!/bin/bash Script Creation Date 01/21/2010 Author baraghun ... (7 Replies)
Discussion started by: raghunsi
7 Replies

10. Shell Programming and Scripting

sh syntax error unexpected token done

I'm getting the following error: line 21: syntax error near unexpected token `done` line 21: `done` and I haven't been able to figure out why. Here is my code #!/bin/sh if ; then echo 'Usage: rename getexp/replStr ' exit 0 fi arg = $1 shift while ; do (5 Replies)
Discussion started by: NullPointer
5 Replies
Login or Register to Ask a Question