LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 09-01-2015, 04:14 PM   #1
ukrishna
LQ Newbie
 
Registered: Sep 2015
Posts: 1

Rep: Reputation: Disabled
BASH shell environment variable


Hi,

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
allend
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 4,603

Rep: Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509Reputation: 1509
This looks like a RedHatism involving the at utility. https://bugzilla.redhat.com/show_bug.cgi?id=1146958
 
1 members found this post helpful.
Old 09-01-2015, 04:36 PM   #3
Tchiarot
Member
 
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
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,529

Rep: Reputation: 2896Reputation: 2896Reputation: 2896Reputation: 2896Reputation: 2896Reputation: 2896Reputation: 2896Reputation: 2896Reputation: 2896Reputation: 2896Reputation: 2896
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:
Quote:
In that environment I updated the .cshrc file and sourced it in my home directory.
 
Old 07-08-2016, 12:38 PM   #5
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,945
Blog Entries: 14

Rep: Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163Reputation: 1163
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:
https://bugzilla.redhat.com/show_bug.cgi?id=1147043

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:
https://bugzilla.redhat.com/show_bug.cgi?id=1147043#c47

Code:
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:
Code:
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.
 
  


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:37 AM.

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