LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > 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
  Search this Thread
Old 10-17-2003, 05:53 AM   #1
flyingalex
LQ Newbie
 
Registered: Oct 2003
Posts: 3

Rep: Reputation: 0
awk strange behaviour in tcsh


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
 
Old 10-17-2003, 07:39 AM   #2
jkobrien
Member
 
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507

Rep: Reputation: 30
Hi,

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

John
 
Old 10-17-2003, 09:29 AM   #3
flyingalex
LQ Newbie
 
Registered: Oct 2003
Posts: 3

Original Poster
Rep: Reputation: 0
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.
 
Old 10-17-2003, 10:03 AM   #4
jkobrien
Member
 
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507

Rep: Reputation: 30
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
 
Old 10-17-2003, 10:15 AM   #5
flyingalex
LQ Newbie
 
Registered: Oct 2003
Posts: 3

Original Poster
Rep: Reputation: 0
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
 
Old 10-17-2003, 10:27 AM   #6
jkobrien
Member
 
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507

Rep: Reputation: 30
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


All times are GMT -5. The time now is 02:30 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration