LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-08-2012, 07:57 PM   #1
dspjm
Member
 
Registered: Dec 2010
Distribution: Scientific Linux Slackware
Posts: 91

Rep: Reputation: 2
Smile how is bash set command used


Within the manual, I know that set command is used to set options for bash, but it says when no options are specified, values are printed, while I saw lots of variable values and a sequence of statements, I didn't figure out how is that different from env command. some options such as set -C, I don't know how to find out if it has been set.

and in its syntax
set [-abCefmnuvx][-h][-o option][argument...]
what does argument mean while i don't see any operations would need it.

Thanks for answering.
 
Old 12-08-2012, 09:40 PM   #2
rigor
Member
 
Registered: Sep 2003
Location: 19th moon ................. ................Planet Covid ................Another Galaxy;............. ................Not Yours
Posts: 705

Rep: Reputation: Disabled
In the man page for bash that is installed in my Linux sys, it says that the currently set options are kept in $-

Code:
echo $-
does indeed show me the options which are currently set.

However, even though the bash man page says that the set command without options displays the shell variables, for me, it shows not only the shell variables, but defined shell functions as well. That's how it's different from the env command.
 
Old 12-08-2012, 11:57 PM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
The env command shows only the variables that are exported to the environment. The set command shows all variables, both internal and exported.
 
Old 12-09-2012, 12:16 PM   #4
rigor
Member
 
Registered: Sep 2003
Location: 19th moon ................. ................Planet Covid ................Another Galaxy;............. ................Not Yours
Posts: 705

Rep: Reputation: Disabled
Good point! ( well, variables and functions )
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why does this work from the bash command line and then fails in a bash script? Rupadhya Linux - Newbie 5 09-26-2012 12:05 AM
[SOLVED] How write a literal bash command in a bash file? xeon123 Linux - Newbie 6 11-29-2010 12:05 PM
PATH set incorrectly and lost bash: vi command... how can I change .bashrc? Lindz Linux - Newbie 10 09-23-2009 05:01 AM
[SOLVED] Using a long Bash command including single quotes and pipes in a Bash script antcore Linux - General 9 07-22-2009 11:10 AM
Bash: set Konsole window title to current command bforbes Programming 5 04-19-2006 11:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:43 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
Open Source Consulting | Domain Registration