LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   error: unexpected token `newline' (http://www.linuxquestions.org/questions/programming-9/error-unexpected-token-%60newline-111870/)

CarlosV 11-03-2003 12:34 PM

error: unexpected token `newline'
 
Hi all,

when i run this line in shell works ok:

cat /userdir/file.conf | sed "s/100.100.100.100/200.200.200.200/g" > /userdir/file.conf1

but i want to add it in a shell script, and when i run it i got an error:

./test: line 2: syntax error near unexpected token `newline'
./test: line 2: `cat /userdir/file.conf | sed "s/100.100.100.100/200.200.200.200/g" >'


my script is this:

#!/bin/sh
cat /userdir/file.conf | sed "s/100.100.100.100/200.200.200.200/g" >
/userdir/file.conf1


i hope someone can help me finding where my error is or what i need to change to run it in a script

Thank You
Carlos V.

jhorvath 11-03-2003 12:37 PM

move the third line to the end of the second

if it is imperitive that this line (the third one) be seperate for some reason ...you have to change it to this:

Code:

#!/bin/sh
cat /userdir/file.conf | sed "s/100.100.100.100/200.200.200.200/g" >\
/userdir/file.conf1


CarlosV 11-03-2003 01:06 PM

It works Thank You Jeremy :)

maryamf 05-17-2011 04:14 AM

unexpected token 'newline'
 

when i run this lines in shell works ok:
echo "[Desktop Entry]
Type=Application
Encoding=UTF-8
Version=1.0
Name=No Name
Name[en_US]=Firefox
Exec=/home/jboss/bin/waitAndStart.sh
X-GNOME-Autostart-enabled=true" >
/home/jboss/.config/autostart/firefox.desktop

acid_kewpie 05-17-2011 04:47 AM

Don't drag up 8 year old threads. new question = new thread. Not that you've even asked a question at all.


All times are GMT -5. The time now is 11:23 PM.