LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-18-2010, 07:46 AM   #1
raige
LQ Newbie
 
Registered: Nov 2010
Posts: 2

Rep: Reputation: 0
simple problem with script


Heya, so here's part of the script

echo <h1>$x</h1> > ind.$x.xhtml

problem here is that it says error due syntax error near unexpected token >
im quite sure anyone who has bit more expertise with linux sees the problem in nanosecond, so please help out and tell me how do i get that to work. I kinda see what the problem is but im not sure how to get around it. Thanks for your help
 
Old 11-18-2010, 07:53 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Maybe you just need to look at what your trying to do?

If I were to hazard a guess it looks like you are trying to redirect a line into a file. Yes?

Which symbol in the line you have presented does that?

How many do you have on the same line?
 
Old 11-18-2010, 08:14 AM   #3
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Posts: 952

Rep: Reputation: 217Reputation: 217Reputation: 217
NAh. He is creatintg HTML code but hasn't escaped the < and >.

So escape the characters by prefixing the characters with a backslash.

OK
 
Old 11-18-2010, 08:37 AM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Well I was kind of hoping he would get to that on his own
 
Old 11-18-2010, 12:01 PM   #5
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: FreeBSD,Debian wheezy
Posts: 811

Rep: Reputation: 179Reputation: 179
Quote:
Originally Posted by raige View Post
echo <h1>$x</h1> > ind.$x.xhtml
Quote:
Originally Posted by AnanthaP View Post
escape the characters by prefixing the characters with a backslash.
That will work, thus:
Code:
echo \<h1\>$x\</h1\> > ind.$x.xhtml
But one can get dizzy sorting out all those slashes (forward and backward). A perhaps more readable way:
Code:
echo "<h1>$x</h1>" > ind.$x.xhtml
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple shell script problem enigma87 Programming 8 10-06-2008 08:48 AM
Simple iptables script problem. rookiepaul Linux - Security 4 05-01-2006 03:25 AM
Problem with simple script petenyce Linux - Newbie 1 10-13-2005 09:00 AM
simple script problem jong357 Programming 2 09-24-2005 04:13 PM
problem with a simple script bash stockerz Linux - Newbie 1 09-21-2004 11:42 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration