Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-23-2006, 10:58 PM   #1
Registered: Mar 2006
Location: San Salvador, El Salvador
Distribution: Gentoo
Posts: 32

Rep: Reputation: 15
Unhappy representing the "-" character without bash considering it an argument

hello. I would like to pass a network name in hamachi which starts with a "-"... but that is not actually the point here. I want to know, if there is(and I am quite sure there must be) a way to represent the - character without really actually using it, or by prefixing another character to it( like the "\ " for representing a space, for example). Thank you (NOTE: enclosing the name in "" did not work)
Old 04-23-2006, 11:43 PM   #2
Senior Member
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (
Posts: 1,900

Rep: Reputation: 68
It is not a bash problem, it's an application problem. Did you ever try giving -- after specifying all arguments (and before the network name)?
Old 04-23-2006, 11:45 PM   #3
Senior Member
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
It depends on the program.

A dash is not a special character to bash. So bash will pass it directly to the program your command line invokes. So, the program you're using needs to be smart about it. A common tool is for programs to use a double dash (--) to represent the end of options for the program, meaning everything following the double dash should not be considered an option regardless of its format. Grep uses the double dash method for instance (grep -- -some_text some_file.txt)

You'll need to read up on the documentation of the program you're using through man pages or online sources. Worst case, you'll have to crack open the source code and see.

EDIT: Raskin beat me to the punch... Doh!
Old 04-24-2006, 01:27 AM   #4
Registered: Mar 2006
Location: San Salvador, El Salvador
Distribution: Gentoo
Posts: 32

Original Poster
Rep: Reputation: 15
hey, wow, thanks! looks like you do learn something new every day ^^;;


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
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 7 12-19-2015 01:03 AM
How to write a bash script to replace all "KH" to "K" in file ABC??? cqmyg5 Slackware 4 07-24-2007 09:00 AM
Where to download precompiled bash binaries, such as "time" and "top"? elinuxqs Linux - Newbie 12 11-14-2005 08:36 PM
bash equivalence of tcsh "alias em "emacs \!:1 &""? rgiggs Slackware 3 07-29-2004 02:07 AM
bash-2.05b# Xlib: extension "XFree86-DRI" missing on display ":0.0". citrus Linux - General 8 02-22-2004 10:43 AM > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration