egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

exec awk problem with quotes

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
BCyo+8C4
Voice


Joined: 03 Sep 2006
Posts: 24

PostPosted: Mon Jul 21, 2008 2:24 pm    Post subject: exec awk problem with quotes Reply with quote

Hi,
I need a tcl to start awk like this:
Code:
awk -f alfa.awk -v was="array('$mask'" bans-$chan.txt >bans-$chan-tmp.txt


But when I put it in my script (after exec) like that it complains about "extra characters after close-quote"

If I escape them (\") I get: Invalid command name """

I also tried this but that failed as well:
Code:
set varname "awk -f alfa.awk -v was=\"array('$mask'\" bans-$chan.txt >bans-$chan-tmp.txt"
eval exec $varname


What's the correct way to escape those quotation chars?
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Mon Jul 21, 2008 2:32 pm    Post subject: Reply with quote

Code:
set awk [list awk -f alfa.awk -v was="array('$mask'" bans-$chan.txt >bans-$chan-tmp.txt]
eval exec $awk

Encapsulate your arguments within [list] evaluation. See if that helps.
Quote:
<speechles> .tcl set a [list awk -f alfa.awk -v was="array('mask'" bans-chan.txt >bans-chan-tmp.txt]
<bot> Tcl: awk -f alfa.awk -v was=\"array('mask'\" bans-chan.txt >bans-chan-tmp.txt
* I had to strip the $ from your variables as I don't have those set *
* It would've worked with them if I had those set... *

_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
BCyo+8C4
Voice


Joined: 03 Sep 2006
Posts: 24

PostPosted: Mon Jul 21, 2008 3:11 pm    Post subject: Reply with quote

that doesn't work either.
while there's no error in console now the file is simply not changed, it's like awk didn't run at all.

example "bans-chan.txt":
Code:
); ?>


example tcl:
Code:
set awk [list awk -f alfa.awk -v was=");" bans-chan.txt >bans-chan-tmp.txt]
eval exec $awk


the awk command itself is correct as it works in shell


EDIT: Well, never mind I guess, I found another solution (without using awk)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber