LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   bash set (https://www.linuxquestions.org/questions/linux-newbie-8/bash-set-826343/)

bbb125 08-15-2010 08:19 AM

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.

GrapefruiTgirl 08-15-2010 08:33 AM

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 :)

jay73 08-15-2010 09:17 AM

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

camelrider 08-15-2010 08:10 PM

echo $SET ?


All times are GMT -5. The time now is 05:47 AM.