LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 08-15-2010, 09:19 AM   #1
bbb125
LQ Newbie
 
Registered: Aug 2010
Posts: 17

Rep: Reputation: 1
bash set


hi all,

I've read that the set command can be used to list environment variables in bash. However, when I type set I get what looks like code from some kind of shell script:

...
return $?;
else
return 127;
fi;
fi
}
dequote ()
{
eval echo "$1" 2> /dev/null
}
quote ()
{
echo \'${1//\'/\'\\\'\'}\'
}
quote_readline ()
{
if [ -n "$bash4" ]; then
echo "${1}";
return;
fi;
local t="${1//\\/\\\\}";
echo \'${t//\'/\'\\\'\'}\'
}

Any idea why this would not list the environment variables? I am running Ubuntu 10.04.
 
Old 08-15-2010, 09:33 AM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Perhaps `set` is aliased to something else?

try the `alias` command in your shell and see..

Meanwhile, you could use the `env` command to see environment variables.

NOTE: These are general ideas - if Ubuntu does something strange that I don't know about, well.. I don't know about it
 
Old 08-15-2010, 10:17 AM   #3
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
Normal behaviour. "set" prints all shell variables, including functions (with their implementation details). Try set | less and you will see that it does contain what your were looking for.

If you need something more specific , try:
echo $BASHOPTS
echo $SHELLOPTS
set +o
set -o
shopt -s
shopt -u
declare -r
declare -a
declare -f
declare -i
declare -x
 
1 members found this post helpful.
Old 08-15-2010, 09:10 PM   #4
camelrider
Member
 
Registered: Apr 2003
Location: Juneau, Alaska
Posts: 247

Rep: Reputation: 31
echo $SET ?
 
  


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
Tab width in Bash - how do I set it benr77 Linux - General 8 12-04-2012 11:53 AM
bash script : another set of eyes, please? brumster Programming 13 01-29-2009 07:27 PM
set and export using bash script acummings Linux - General 10 01-03-2005 03:22 PM
how do i set global prefs for bash polonius19 Slackware 2 03-06-2003 06:23 PM
Cant set color or promt in bash outsider Linux - General 2 10-15-2001 01:26 AM


All times are GMT -5. The time now is 06:37 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration