LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 05-06-2009, 04:08 AM   #1
stormcloud
Member
 
Registered: Apr 2009
Posts: 32

Rep: Reputation: 15
Just curious: BASH variable $-


Hi,

I'm curious; I know that bash supports a variable called $- which gives you information about how the shell it's self is configured, but i don't know much more then that.

Can anybody point me to a good web site that explains what each of the characters in the returned string means. Google, altavista, yahoo etc get a bit confused when I search on $-

Thanks.
 
Old 05-06-2009, 04:26 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Take a look at bash's manpage, especially the set [--abefhkmnptuvxBCHP] section.

The i isn't mentioned (if it shows up at all after echo $-), this tells you if bash is interactive (i is shown) or not.

Hope this helps.
 
Old 05-06-2009, 04:32 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Just look at man set and man bash. They describes all the available options. On my system running CentOS 5.3 I have:
Code:
$ echo $-
himBH
where
Code:
-h      Remember  the  location  of  commands  as  they  are looked up for execution.  This is
        enabled by default.
-i      If the -i option is present, the shell is interactive.
-m      Monitor  mode.   Job control is enabled.
-B      The  shell  performs  brace  expansion.
-H      Enable !  style history substitution.
 
Old 05-06-2009, 11:44 AM   #4
amysaraantony
Member
 
Registered: Apr 2009
Posts: 42

Rep: Reputation: 16
The MAN command is your friend sir!


Debian

Last edited by amysaraantony; 05-15-2009 at 08:12 PM.
 
Old 05-07-2009, 02:37 AM   #5
stormcloud
Member
 
Registered: Apr 2009
Posts: 32

Original Poster
Rep: Reputation: 15
Thanks for the advice everybody. Much appreciated.

I never thought of looking at man for bash it's self, and you can't run "man $-"
 
  


Reply



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
passing variable from bash to perl in a bash script quadmore Programming 6 02-21-2011 04:11 AM
Problem with bash script - variable name within variable name steven.c.banks Linux - Newbie 3 03-10-2009 03:08 AM
BASH: instad of echo-ing, I just want to assing to a bash variable... how?? rylan76 Linux - Newbie 9 11-28-2008 08:46 AM
bash scripting need help getting a variable of a variable dovo Programming 6 10-29-2008 01:30 PM
Curious bash prompt editing question. xconspirisist Linux - Software 3 11-19-2005 07:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:18 AM.

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
Open Source Consulting | Domain Registration