LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux 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



Reply
 
Search this Thread
Old 11-10-2006, 08:54 AM   #1
Fle><
Member
 
Registered: Dec 2003
Location: Vienna | Austria
Distribution: Gentoo
Posts: 52

Rep: Reputation: 15
turn off event designator without recompiling the bash


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?
 
Old 11-10-2006, 09:14 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
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
 
Old 11-10-2006, 09:42 AM   #3
Fle><
Member
 
Registered: Dec 2003
Location: Vienna | Austria
Distribution: Gentoo
Posts: 52

Original Poster
Rep: Reputation: 15
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).
 
Old 11-10-2006, 04:25 PM   #4
Fle><
Member
 
Registered: Dec 2003
Location: Vienna | Austria
Distribution: Gentoo
Posts: 52

Original Poster
Rep: Reputation: 15
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)
 
Old 11-10-2006, 05:22 PM   #5
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
Well that's how to prevent the shell from interpreting the ! as an event. I don't know about iptables.
 
Old 11-10-2006, 05:32 PM   #6
Fle><
Member
 
Registered: Dec 2003
Location: Vienna | Austria
Distribution: Gentoo
Posts: 52

Original Poster
Rep: Reputation: 15
Thumbs up

you're right, that was an iptables fault.
problem solved, thanks a lot.
 
  


Reply

Tags
event, expansion, history


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
turn off BEEP in BASH shell SpiderIRE Linux - Newbie 7 07-10-2014 03:19 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 01:51 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration