Display environment variable and custom script

Joined
Jun 2, 2009
Messages
44
Reaction score
0
Points
6
Location
Chennai
Your Mac's Specs
MacBook Pro 15.4" 2.4GHz C2D 2GB RAM 250GB HDD Mac OS X-10.5.8, Apple iPod nano 8GB Black
Hi folks,

I have a custom script, that shows the current battery charge in my command prompt. It was quit fine till, last shutdown. But when I rebooted my machine, the battery charge was not updating on each prompt, rather, it was showing the same charge, when the terminal has been started. I found that, the script was not executing, as it was executed upon each "RETURN" hit.

I found a new variable in my environment, after I type env ( I think it is new, because, I don't remember it was shown before) and since, I am exporting PS1 (in which my custom script lies) from the .bashrc.

The only thing, I have done was installed mplayer via macport and viewed a video file using xquartz as the video output. I suspect this might have changed my settings. And now my DISPLAY variable is as follows,

DISPLAY=/tmp/launch-LjmwIR/:0

I don't have any idea, where is is being set (I have checked my .bashrc and .bash_profile files, but no trace of it).

Could anyone shed some light on it, where this variable might have been set and how to unset it?

Please correct me, if my guess is wrong and there is something else is the reason behind it?

Thanks a ton in advance.
 

rman


Retired Staff
Joined
Dec 24, 2002
Messages
12,637
Reaction score
168
Points
63
Location
Los Angeles, California
Your Mac's Specs
14in MacBook Pro M1 Max 32GB 2TB
check the following files:

/private/bashrc
/private/csh.login
/private/profile
/profile/zprofile
 
OP
R
Joined
Jun 2, 2009
Messages
44
Reaction score
0
Points
6
Location
Chennai
Your Mac's Specs
MacBook Pro 15.4" 2.4GHz C2D 2GB RAM 250GB HDD Mac OS X-10.5.8, Apple iPod nano 8GB Black
Thank you rman for you reply.

But, again no trace of DISPLAY variable.

My question now is, why my $PS1 variable is set properly, when the terminal starts, but not updated upon each RETURN hit. Previously, it was very fine and I got updated prompt(here updated, I mean by battery charge update, by script), every time I hit RETURN.

Have any clue?!
 

rman


Retired Staff
Joined
Dec 24, 2002
Messages
12,637
Reaction score
168
Points
63
Location
Los Angeles, California
Your Mac's Specs
14in MacBook Pro M1 Max 32GB 2TB
Look at the dot files in your home directory/folder. See if any has changed, that you did not change.
 
OP
R
Joined
Jun 2, 2009
Messages
44
Reaction score
0
Points
6
Location
Chennai
Your Mac's Specs
MacBook Pro 15.4" 2.4GHz C2D 2GB RAM 250GB HDD Mac OS X-10.5.8, Apple iPod nano 8GB Black
Thank you for you reply rman.

Nothing has changed in my home folder . files (which I have already checked). I am scratching my head, just because of this. I believe, some other setting is overriding my $PS1, since when my terminal starts, my $PS1 is promptly exported and not afterwards.!!

rman, you have any suggestions?!

Thanks a lot.
 
OP
R
Joined
Jun 2, 2009
Messages
44
Reaction score
0
Points
6
Location
Chennai
Your Mac's Specs
MacBook Pro 15.4" 2.4GHz C2D 2GB RAM 250GB HDD Mac OS X-10.5.8, Apple iPod nano 8GB Black
Hi friends,

I found what was wrong, and it is nothing to do with the environment variable (DISPLAY). Since, $PS1 overrides it.

And the problem was in my $PS1 export prompt,

previously, it was,

export PS1="${BLUE}\u${BLACK}@$(bat) ${MAGENTA}\W:${BLACK}"

this, the problem is , there was a slash missing before the $(bat). After adding,it now my prompt works like charm.

Sorry for made you guys head scratch. Thank you rman.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top