LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Thread Tools
Old 10-17-2003, 06:53 AM   #1
flyingalex
LQ Newbie
 
Registered: Oct 2003
Posts: 3
Thanked: 0
awk strange behaviour in tcsh


[Log in to get rid of this advertisement]
Hi folks

This command under tcsh does not work

awk "BEGIN {print \" Don't Panic \" } "

resulting in

Unmatched ".

while it works fine under bash!

Does anyone have any idea about the reason of it?

cheers

Alex
flyingalex is offline     Reply With Quote
Old 10-17-2003, 08:39 AM   #2
jkobrien
Member
 
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507
Thanked: 0
Hi,

Don't know the reasons why, but using hex codes does work under tcsh
awk 'BEGIN {print "\x22 Don\x27t Panic \x22" }'

John
jkobrien is offline     Reply With Quote
Old 10-17-2003, 10:29 AM   #3
flyingalex
LQ Newbie
 
Registered: Oct 2003
Posts: 3
Thanked: 0

Original Poster
Hi

it does work, but writes the double quotes too, as
they also were part of the string.
That's different from the original idea.
Also you used single quotes before BEGIN and at the end of the line.
Let me know if you find some other solution.
flyingalex is offline     Reply With Quote
Old 10-17-2003, 11:03 AM   #4
jkobrien
Member
 
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507
Thanked: 0
Sorry, I thought you wanted the quotes. In that case...

awk 'BEGIN {print "Don\x27t Panic" }'

... is what you want.

Why do you care about using single quotes around the awk command? Are you just trying to understand how the t shell works with quote marks? I've always had a hard time keeping that straight, and generally just mess around until I find what works.

John
jkobrien is offline     Reply With Quote
Old 10-17-2003, 11:15 AM   #5
flyingalex
LQ Newbie
 
Registered: Oct 2003
Posts: 3
Thanked: 0

Original Poster
Hi

Thanks John!Indeed it works!
I still wonder why the two shells behave so
differently though, what the reason of it really is!

Let me know if you come with some idea about it.

Alex
flyingalex is offline     Reply With Quote
Old 10-17-2003, 11:27 AM   #6
jkobrien
Member
 
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507
Thanked: 0
Hi Alex,

Well the short answer is that the bash shell and the tcsh shell just handle quote marks differently depending on what the authors thought would work best.

If you read up on bash, on tcsh and on awk, I'm sure you'll get it all sorted out as to how each behaves and they're not totally inconsistent with each other. But, speaking for myself, it's hard to keep that clear in my memory so usually in a situation like that I just mess around with various combinations until I hit on the one that works. With experience it doesn't take long.

John
jkobrien is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
Strange behaviour Anmol Suse/Novell 2 10-28-2005 12:05 AM
Strange grub behaviour bigjohn Linux - Software 6 05-20-2005 04:00 PM
SCP strange behaviour sbalasuriya Linux - Software 0 09-21-2004 11:50 AM
Opera's strange behaviour neo77777 Linux - General 5 04-04-2002 12:18 AM
Strange Behaviour mikeyt_3333 Linux - General 4 08-06-2001 04:07 PM


All times are GMT -5. The time now is 12:09 PM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration