Definition of $-


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Definition of $-
# 1  
Old 06-01-2009
Definition of $-

Could someone please direct me to a link that gives the definitions for each of the letters from the results of the $- environment variable? It would be nice to know what shell options each of the letters represents, but I am specifically looking for the shell option for 'c' (lowercase c). Thank you.
# 2  
Old 06-02-2009
# 3  
Old 06-08-2009
Thank you for the reply. Sorry I haven't replied to this sooner but I've been out.

The link provided simply says to look at the man page for setting shell options for your particular shell. Well, that was the first thing I did when I was trying to figure this out. Unfortunately, the man pages for bash and ksh do not detail exactly which letter is associated with which shell option, and the letter is certainly not the first letter of the option itself. Some of them are obvious, like 'i' for interactive shell. Some I could figure out by turning off an option and looking to see what letter no longer existed when echoing $-. Unfortunately some of the options could not be determined this way. And I'm still trying to figure out what little 'c' means (in addition to some others).
# 4  
Old 06-08-2009
did you mean this??
Quote:
-c String
Causes the Korn shell to read commands from the String variable. This flag cannot be used with the -s flag or with the File[Parameter]
parameter.
# 5  
Old 06-08-2009
No. What I'm talking about is the following. If you echo $- from your interactive login shell you'll get something like this...

$ echo $-
himBCH

Each of these letters represent some option that is turned on within the shell. For example, the 'i' (lowercase i) indicates an interactive login shell. Now, if I execute this same echo command from within a script that my dtsession login process executes when logging in, I get the following...

echo $-
hBCc

What I would like to know is what shell option the 'c' (lowercase c represents).
# 6  
Old 06-08-2009
I think thats what i posted
It passes -c option to shell whos explanation is given in man page of ksh or bash or ...
# 7  
Old 06-08-2009
I could be wrong, but I believe that is simply a command line option that you send to the shell when you're starting it. It's not a "switch" (so to speak) that you turn on or off for shell options from within the shell. For example, expand_aliases is a shell option that you can turn on or off. That particular option however, doesn't seem to have a letter associated with it when you execute $-. So, to see it's state, you have to execute the shopt command.

Anyway, maybe I'm mistaken about this whole thing, but what purpose would it serve to have $- report that the shell was started with some command string. You still wouldn't know what the command was, only that some command was executed, and it really wouldn't represent a switch for some option that is enable/disabled.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Get struct definition

I have many headers with huge amount of structures in them, typical one looks like this: $ cat a.h struct Rec1 { int f1; int f2; }; struct Rec2 { char r1; char r2; }; struct Rec3 { int f1; float k1; float ... (6 Replies)
Discussion started by: migurus
6 Replies

2. UNIX for Advanced & Expert Users

Variable definition

Hi all, I'm bit new to the advanced bash shell scripting. When I'm looking at some of the existing code in my organization, got confused with a few variable definings. For ex: var1={1:-30} var2="abc def ghi" var3={xyz:-$var2} In above, 1st and last lines are confusing me.... (4 Replies)
Discussion started by: raghu.iv85
4 Replies

3. What is on Your Mind?

Definition of Bytes

A byte is the smallest unit of storage which can be accessed in a computer's memory- either in RAM or ROM.It also holds exactly 8 bits.But its old view one byte was sufficient to hold one 8 bit character.Modern days especially on .NET or international versions of Win 32, 16 bits is needed. ... (2 Replies)
Discussion started by: stoudtLion
2 Replies

4. Fedora

Shell parameter definition

Hi Folks, I have a script called program.sh which was written by someone. I am supposed to edit it for my necessities. There is a line in the script that is as follows if ]; then echo -e "Option limit should be positive number and less than 1. Program aborts!" exit 1 ... (27 Replies)
Discussion started by: jacobs.smith
27 Replies

5. HP-UX

macro definition in FTP

Hi, I am trying to create a macro in FTP to rename multiple files.Below given is the codewhich i tried. I wanted to pass the files from the file "$FTPTXRENAMESUCLIST`" to the renfiles macro. Your help will be really appreciated. ftp -i -v -n << endftp > $FTPTXLOG 2> $FTPER open... (0 Replies)
Discussion started by: tinivt
0 Replies

6. UNIX for Dummies Questions & Answers

What is inside the definition of Unix?

Is FreeBSD and OpenBSD considered Unix? What O.S does Most of the forum members use? How popular are Licensed Unix operating systems for home users? Additionally I thought Linux was a Minux fork and BSD was a Unix fork. Thanks in ... (7 Replies)
Discussion started by: theKbStockpiler
7 Replies

7. Shell Programming and Scripting

daemons definition

hi there, can somebody give me a definition for daemons, or example what are they !! and what the use for? i've done some research and all what i found is /etc/... or /usr/bin/... and i haven't quietly got the concept. any ideas !! Thanks. (5 Replies)
Discussion started by: new2Linux
5 Replies

8. UNIX for Dummies Questions & Answers

Paging space definition

sorry for this silly question, I am new to UNIX, what is meant by paging space and what is its purpose? what is also meant by hd6 paging space? (2 Replies)
Discussion started by: docaia
2 Replies

9. Programming

process image + definition

Ive seen this word being popped up whenever I read the Unix man description of the exec() family of functions. What exactly does it refer to, as I can't seem to comprehend how processes would have an image ? cheers (1 Reply)
Discussion started by: JamesGoh
1 Replies

10. UNIX for Dummies Questions & Answers

Printer definition file on HP

Hello, I'm looking for the definition file for printers on HP. Can I implement printers.conf like on SUN ? Thanks for your help:( (4 Replies)
Discussion started by: annececile
4 Replies
Login or Register to Ask a Question