LinuxQuestions.org
Support LQ: Use code LQCO20 and save 20% on CrossOver Office
Go Back   LinuxQuestions.org > Forums > Linux > Linux - General
User Name
Password
Linux - General This forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Tags used in this thread
Popular LQ Tags , , ,

Reply
 
Thread Tools
Old 11-10-2006, 08:54 AM   #1
Fle><
Member
 
Registered: Dec 2003
Location: Vienna | Austria
Distribution: Gentoo
Posts: 52
Thanked: 0
turn off event designator without recompiling the bash


[Log in to get rid of this advertisement]
hi, my problem is a command like that:
Quote:
iptables -A INPUT -s 127.0.0.1 -d !127.0.0.1 -j REJECT
The bash substitutes !127 with a command from the history, and so the iptables command doesn't work.

Is there a way to turn this behavior off without recompiling the shell and disable the option "-enable-bang-history"? What is an alternative to write iptables commands like my own?
Fle>< is offline  
Tag This Post , , ,
Reply With Quote
Old 11-10-2006, 09:14 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu (x86), Debian (PPC)
Posts: 3,495
Thanked: 6
You can escape the ! with a backslash, \, like this:
Code:
iptables -A INPUT -s 127.0.0.1 -d \!127.0.0.1 -j REJECT
You can also quote the parameter which includes the ! in single quotes (note NOT backticks!):
Code:
iptables -A INPUT -s 127.0.0.1 -d '!127.0.0.1' -j REJECT
matthewg42 is offline     Reply With Quote
Old 11-10-2006, 09:42 AM   #3
Fle><
Member
 
Registered: Dec 2003
Location: Vienna | Austria
Distribution: Gentoo
Posts: 52
Thanked: 0

Original Poster
I think I tried that already... but I am not sure so I will give it a try (again) in the evening (have no possibility now).
Fle>< is offline     Reply With Quote
Old 11-10-2006, 04:25 PM   #4
Fle><
Member
 
Registered: Dec 2003
Location: Vienna | Austria
Distribution: Gentoo
Posts: 52
Thanked: 0

Original Poster
No, this do not work:
Quote:
# iptables -A INPUT -s 127.0.0.1 -d '!127.0.0.1' -j REJECT

# iptables -A INPUT -s 127.0.0.1 -d \!127.0.0.1 -j REJECT
after pressing enter the cursor jumps into the next line and waits...and waits... and nothing happens (until ctrl + c)
Fle>< is offline     Reply With Quote
Old 11-10-2006, 05:22 PM   #5
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu (x86), Debian (PPC)
Posts: 3,495
Thanked: 6
Well that's how to prevent the shell from interpreting the ! as an event. I don't know about iptables.
matthewg42 is offline     Reply With Quote
Old 11-10-2006, 05:32 PM   #6
Fle><
Member
 
Registered: Dec 2003
Location: Vienna | Austria
Distribution: Gentoo
Posts: 52
Thanked: 0

Original Poster
Thumbs up

you're right, that was an iptables fault.
problem solved, thanks a lot.
Fle>< 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
turn off BEEP in BASH shell SpiderIRE Linux - Newbie 6 10-24-2009 05:41 PM
(bash) echo "#!/bin/bash" event not found - trying to generate profiles automatically jimieee Programming 9 05-03-2006 11:24 AM
What would be the designator for a USB drive? 357mag Mandriva 3 03-01-2005 12:13 PM
how do i turn off read only in knoppix bash ChopSueyX Linux - Newbie 7 11-20-2003 09:20 PM
Cygwin:How do you turn the bash shell bell off? petercool Linux - Newbie 8 05-23-2003 11:48 AM


All times are GMT -5. The time now is 05:48 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