Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 09-01-2015, 04:14 PM   #1
LQ Newbie
Registered: Sep 2015
Posts: 1

Rep: Reputation: Disabled
BASH shell environment variable


I am running a utility that does not like a certain environment variable in my BASH shell. (No one in my team has it set). I need the utility and would like to unset the variable. It shows up like this:
BASH_FUNC_module()=() { eval `/usr/bin/modulecmd bash $*`
At the end of printenv output.
It looks like a function, however I do not know what it does.
How do I unset this? I am not even sure, how to parse this variable.
Which file holds environment variables and how are they sourced?
I have some experience in UNIX. In that environment I updated the .cshrc file and sourced it in my home directory.

Last edited by ukrishna; 09-01-2015 at 04:15 PM.
Old 09-01-2015, 04:36 PM   #2
Senior Member
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 4,501

Rep: Reputation: 1383Reputation: 1383Reputation: 1383Reputation: 1383Reputation: 1383Reputation: 1383Reputation: 1383Reputation: 1383Reputation: 1383Reputation: 1383
This looks like a RedHatism involving the at utility.
1 members found this post helpful.
Old 09-01-2015, 04:36 PM   #3
Registered: Feb 2013
Location: Lima, Peru
Distribution: Debian
Posts: 39

Rep: Reputation: Disabled
Did you try unset BASH_FUNC_module ?
If you want to unset variable every time logon edit .bashrc file and at the end write:
unset BASH_FUNC_module
Old 09-02-2015, 03:30 AM   #4
LQ Guru
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,437

Rep: Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842
I am a bit confused that we seem to be talking about bash related variables but that you seem to be working in a cshell environement:
In that environment I updated the .cshrc file and sourced it in my home directory.
Old 07-08-2016, 12:38 PM   #5
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,713
Blog Entries: 14

Rep: Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038
I know this post is old but it led me to one bug report which led to another which led to errata about the "at" command being fixed for this issue on RHEL6.

However, as noted in the latter bug report which is at:

This is not just specific to the "at" command. Here we just ran across it when trying to relink Oracle on RHEL6.

The solution would be to unset this as noted in a prior post here but regular unset of a variable doesn't work because of the () at the end of BASH_FUNC(). The correct way to unset was in comment 47:

unset -f `env | sed -n 's/^BASH_FUNC_\([a-z]*\)()=.*/\1/p'`
Doing that on RHEL6.8 worked to do the unset.

Oops - On RHEL6.8 it did unset the variable but gave error before doing it:
-bash: unset: `f': not a valid identifier

Apparently you don't need the "-f" - just the rest of the line:
unset `env | sed -n 's/^BASH_FUNC_\([a-z]*\)()=.*/\1/p'`
That will do it without the error but either way it does the unset.

Last edited by MensaWater; 07-11-2016 at 03:48 PM.


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
Setting An Environment Variable In Bash? carlosinfl Red Hat 7 02-24-2012 06:55 AM
environment variable issue in shell George2 Linux - Newbie 13 05-27-2010 11:24 AM
how can i change the value of a environment variable through shell script ? manomohan Programming 8 02-11-2010 09:55 PM
shell to set environment variable ufmale Linux - Newbie 5 11-16-2009 11:35 AM
how to unset environment variable in bash suneel Linux - Newbie 7 09-14-2009 10:17 AM

All times are GMT -5. The time now is 08:31 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration