LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

Reply
 
Search this Thread
Old 04-23-2006, 10:58 PM   #1
goens
Member
 
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
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

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
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
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
goens
Member
 
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 ^^;;
 
  


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
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 6 03-21-2013 10:35 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


All times are GMT -5. The time now is 01:42 AM.

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
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration