Reply
Thread Tools
Posts: 773 | Thanked: 854 times | Joined on Jul 2010
#1
whoa: does anyone find that their .bashrc file gets overwritten?
something appears to touch just the line that sets PS1. this could be me somehow, but i really dont think so....

Code:
diff /root/.bashrc /root/.bashrc-from-before-reboot
h='\h'
u='\u'
w='\w'
c1='\[\033[01;32m\]'
c2='\[\033[01;34m\]'
cEnd='\[\033[00m\]'
-PS1="$c1$u$h$cEnd:$c2$w$cEnd\$ "
+PS1='\h-40-4_PR_005:$c2$w$cEnd\$ "
it appears to find a line that looks like
Code:
PS1=(BEFORE):(AFTER)
and replace it with
Code:
PS1='\h-VERSION:AFTER
.

which is really annoying, since it is malformed if you dont have a closing single quote {which i dont, as above}.

im going to add another line that sets it more obliquely until i figure out WHAT is setting it and kill it.

EDIT: a workaround is to do COLON=':', and then use $COLON instead of ':' in the line that sets the PS1.
this is not a solution, though, because the replace pattern is so general it could produce all sorts of, erm, interesting behaviour, like bricking my n9.

Last edited by wolke; 2012-01-23 at 17:22.
 
Posts: 773 | Thanked: 854 times | Joined on Jul 2010
#2
im using bash, btw, not ash.
i have a .profile:
unset DISPLAY && exec bash
 
Posts: 773 | Thanked: 854 times | Joined on Jul 2010
#3
after more extensive testing, it seems that ANY line that matches the perl regex:

Code:
(.*)PS1=(.*):(.*)
will be replaced with
Code:
$1PS1=$x:$2
where $x is something like
Code:
\h-40-4_PR_005
including comments...

#no PS1=.*:.* line, so n9 wont kill it
=>
#no PS1='\h-40-4_PR_005:.* line, so n9 wont kill it



this is SO stupid its incredible..
 

The Following User Says Thank You to wolke For This Useful Post:
Posts: 36 | Thanked: 36 times | Joined on Nov 2011 @ KL, Msia
#4
Hi,

It is possible that there is a watchdog service running in the background that prevents bashrc from being modified.

But more importantly, why are you tinkering with bashrc? You could just write your own script, and set whatever paths you want there.
 
Posts: 773 | Thanked: 854 times | Joined on Jul 2010
#5
Originally Posted by zero.vishnu View Post
Hi,

It is possible that there is a watchdog service running in the background that prevents bashrc from being modified.

But more importantly, why are you tinkering with bashrc? You could just write your own script, and set whatever paths you want there.
thanks for the reply!

this is my own .bashrc, in $HOME. i use it on every system that runs bash, {n900, laptop, n9, desktop, android ereader, etc}.


the bashrc works fine. i have an open kernel installed, and bash is running nicely, both when i ssh in and when i run meego-terminal. my aliases work, my gnu find/grep work {instead of busybox}.


....until i reboot.
when i reboot, the $HOME/.bashrc gets modified in a strange fashion.

it doesnt get replaced entirely, which i would understand and try to workaround.

only certain lines get changed, and in a very poorly programmed way.

the lines that get changed have to have the string "PS1=" and then the string ":" somewhere after it. lines that meet this arbitrary criteria are replaced as i describe above.
Attached Files
File Type: txt bashrc.txt (2.1 KB, 69 views)
 
Posts: 1,042 | Thanked: 2,575 times | Joined on May 2011 @ Brazil
#6
I also use bash (but not as default shell) on Nokia N9, and the .bashrc is never rewritten. My PS1 line :


Code:
# Set colors for prompt
#
col_bold="\033[1m"
col_red="\033[1;31m"
col_green="\033[1;32m"
col_yellow="\033[1;33m"
col_blue="\033[1;34m"
col_purple="\033[1;35m"
col_cyan="\033[1;36m"
col_normal="\033[0;39m"

# Prompt Settings
# PS1
PS1="\[${col_cyan}\]\u@\h:\[${col_blue}\]\w\[${col_normal}\]\$ "
export PS1
__________________
Python, C/C++, Qt and CAS developer. For Maemo/MeeGo/Sailfish :
Integral, Derivative, Limit - calculating mathematical integrals, derivatives and limits. SymPy - Computer Algebra System.
MatPlotLib - 2D & 3D plots in Python. IPython - Python interactive shell.
-- My blog about mobile & scientific computing ---
Jolla. 2 Nokia N9 16GB Black @ 1.35 GHz, 1 with Sailfish, Stowaway foldable BT keyboard.
Nexus 4 with Sailfish. Nokia N900 @ 1.1 GHz. N810. Nokia 9500. Psion Revo+.
 
Posts: 773 | Thanked: 854 times | Joined on Jul 2010
#7
Originally Posted by rcolistete View Post
I also use bash (but not as default shell) on Nokia N9, and the .bashrc is never rewritten. My PS1 line :


Code:
# Set colors for prompt
#
col_bold="\033[1m"
col_red="\033[1;31m"
col_green="\033[1;32m"
col_yellow="\033[1;33m"
col_blue="\033[1;34m"
col_purple="\033[1;35m"
col_cyan="\033[1;36m"
col_normal="\033[0;39m"

# Prompt Settings
# PS1
PS1="\[${col_cyan}\]\u@\h:\[${col_blue}\]\w\[${col_normal}\]\$ "
export PS1
cool! now, do you put it in /home/.bashrc, or /root/.bashrc {root's home dir}

i believe only the one in /root/.bashrc is getting rewritten for me, contrary to what i implied earlier.
 
Posts: 1,042 | Thanked: 2,575 times | Joined on May 2011 @ Brazil
#8
Yeah, I am surprised to confirm that '/root/.bashrc' has the PS1 overwritten !
__________________
Python, C/C++, Qt and CAS developer. For Maemo/MeeGo/Sailfish :
Integral, Derivative, Limit - calculating mathematical integrals, derivatives and limits. SymPy - Computer Algebra System.
MatPlotLib - 2D & 3D plots in Python. IPython - Python interactive shell.
-- My blog about mobile & scientific computing ---
Jolla. 2 Nokia N9 16GB Black @ 1.35 GHz, 1 with Sailfish, Stowaway foldable BT keyboard.
Nexus 4 with Sailfish. Nokia N900 @ 1.1 GHz. N810. Nokia 9500. Psion Revo+.
 

The Following User Says Thank You to rcolistete For This Useful Post:
Posts: 773 | Thanked: 854 times | Joined on Jul 2010
#9
Originally Posted by rcolistete View Post
Yeah, I am surprised to confirm that '/root/.bashrc' has the PS1 overwritten !
thx, glad this is not me-only. weird bug..
 

The Following User Says Thank You to wolke For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 03:57.