LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-13-2006, 02:21 PM   #1
htarko
LQ Newbie
 
Registered: Aug 2006
Posts: 5

Rep: Reputation: 0
Environment variables for bash


When I run the set command in the bash shell of my SUSE 10.1 Linux version, I get the usual list of environmental varialbes but at the end of the output there is a very large quantity of text that appears to be a shell script of some kind. What is it? Does it indicate a bug in my system? If I go into the plain old Bourne shell by typing
htarko@linux-betz:~> sh
only the environmental variables are printed and the extra output is gone.

The OS runs fine otherwise. I am enclosing a small fragment of the output. It is very long. Thanks for any help you can give.

htarko@linux-betz:~> set | wc
680 1500 21901

htarko@linux-betz:~>set
ACLOCAL_FLAGS='-I /opt/gnome/share/aclocal'
BASH=/bin/bash
BASH_ARGC=()
BASH_ARGV=()
BASH_LINENO=()
BASH_SOURCE=()
...
XMODIFIERS=@im=local
XNLSPATH=/usr/X11R6/lib/X11/nls
XSESSION_IS_UP=yes
YAST=/sbin/yast
_=set
is=bash
s=/etc/bash_completion.d/yast2-completion.sh
_cd_ ()
{
local c=${COMP_WORDS[COMP_CWORD]};
local s g=0 x C;
local IFS='
';
shopt -q extglob && g=1;
test $g -eq 0 && shopt -s extglob;
case "$(complete -p ${1##*/} 2> /dev/null)" in
mkdir)

;;
*)
s="-S/"
;;
esac;
case "$c" in
\$\(*\))
eval COMPREPLY=\(${c}\)
;;
\$\(*)
COMPREPLY=($(compgen -c -P '$(' -S ')' -- ${c#??}))
;;
\`*\`)
eval COMPREPLY=\(${c}\)
;;
\`*)
COMPREPLY=($(compgen -c -P '\`' -S '\`' -- ${c#?}))
;;
\$\{*\})
eval COMPREPLY=\(${c}\)
;;
\$\{*)
COMPREPLY=($(compgen -v -P '${' -S '}' -- ${c#??}))
;;
\$*)
COMPREPLY=($(compgen -v -P '$' $s -- ${c#?}))
;;
\~*/*)
COMPREPLY=($(compgen -d $s -- "${c}"))
;;
\~*)
COMPREPLY=($(compgen -u $s -- "${c}"))
;;
esac;
for x in ${COMPREPLY[@]};
do
x=${x// /\\ };
x=${x//(/\\(};
x=${x//)/\\)};
x=${x//\{/\\\{};
x=${x//\}/\\\}};
x=${x//\[/\\\[};
x=${x//\]/\\\]};
C=(${C[@]} $x);
done;

...

remount ()
{
/bin/mount -o remount,${1+"$@"}
}
spwd ()
{
( IFS=/;
set $PWD;
if test $# -le 3; then
echo "$PWD";
else
eval echo \"..\${$(($#-1))}/\${$#}\";
fi )
}
startx ()
{
test -x /usr/X11R6/bin/startx || {
echo "No startx installed" 1>&2;
return 1
};
/usr/X11R6/bin/startx ${1+"$@"} 2>&1 | tee $HOME/.X.err
}


Howard Tarko
 
Old 09-13-2006, 03:57 PM   #2
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
Those are just some predefined convenience functions that you can use from the console. For example, spwd will return the last two directories of your current working directory:
Code:
ada@barnabas> echo $PWD
/usr/X11/lib/X11/app-defaults
ada@barnabas> spwd
..X11/app-defaults
 
  


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
Bash script environment variables mbjunior99 SUSE / openSUSE 4 12-28-2005 12:40 AM
environment variables user_linux Linux - Newbie 3 06-15-2005 08:46 AM
environment variables Prakhardeep Linux - Software 3 10-06-2004 03:30 AM
environment variables. jISV Linux - General 0 04-05-2002 06:01 AM
environment variables aethereal Linux - Newbie 7 12-19-2001 09:34 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:14 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