Active Topics

 


Reply
Thread Tools
xaccrocheur's Avatar
Posts: 73 | Thanked: 24 times | Joined on Jan 2010 @ Paris
#1
Hi, I adapted my old .bashrc, that has been with me many years, to work on my N900.

Name:  kituu.jpg
Views: 3470
Size:  22.8 KB

You can copy it to all your users/root home folders (and to /etc/skel for all future ones) and it will automatically display "root" in the color you define. Bad root.

Features
  • Fully portable (runs unmodified on all my machines/users)
  • Two-lines stable, consistent display
  • Double-clickable full path
  • Simple and light load-meter
  • Visual status of the latest command output
  • Command history available across all new shells
  • SSH & screen friendly
  • Cool aliases & functions

Installation

as root :
  • apt-get install bash wget
  • cd
  • wget -N "http://talk.maemo.org/attachment.php?attachmentid=22166" -O .bashrc
  • cp .bashrc /home/user/
  • bash
Optional :
apt-get install coreutils-gnu (if you want colored ls)

Optionally, you may want to edit /etc/passwd to change "/bin/sh" to /bin/bash" where applicable.
Any enhancements requests and bug-reports welcome.

Notes
The xterm system on Maemo is tricky. X Terminal launches xterm who launches busybox who then launchs ash (o_O) Look at how I implemented it (both from desktop and ssh) and feel free to suggest a better way : Right now it handles ssh nicely, but strangely, when used in hildon X-Terminal I have to manually enter "bash" each time... Any thought?

(The attachment has a low viewcount because I upload new tweaks, and it keeps resetting..?)

Changelog
Removed bc dependency
Better handling of old (<3) BASHes

Thank you for your encouragements
Attached Files
File Type: txt bashrc.txt (5.6 KB, 473 views)

Last edited by xaccrocheur; 2011-08-17 at 16:04.
 

The Following 2 Users Say Thank You to xaccrocheur For This Useful Post:
Posts: 298 | Thanked: 197 times | Joined on Dec 2009 @ Norway
#2
Sweet, but what version do you have? I'm running bash 2.05b at the moment... :P (I know, but it's the only I found to show username and hostname...)
I will try this out.
 
Posts: 2,225 | Thanked: 3,822 times | Joined on Jun 2010 @ Florida
#3
Keep in mind busybox-power can provide ls colors too, so it'd be great if you adapted your dependencies accordingly.
 
Posts: 147 | Thanked: 7 times | Joined on Aug 2010
#4
where i can change the color of background and color of text ?
 
xaccrocheur's Avatar
Posts: 73 | Thanked: 24 times | Joined on Jan 2010 @ Paris
#5
Originally Posted by Mentalist Traceur View Post
Keep in mind busybox-power can provide ls colors too, so it'd be great if you adapted your dependencies accordingly.
Well it's not a dependency per se, just a way to have colored ls. Besides, I figured if one really wants to use busybox(-xx) "ls", why would one bother with a .bashrc..?

As for the only other one dependency (apart from BASH itself), "bc", I found a way to round floating to integers on old BASHs, so I removed it, so this compatible with ALL BASH VERSIONS.

I wanted to test busybox-power but had second thoughs. I prefer not to touch it (specially since it overwrites it !) and go with the "core package untouched, additional package for power-users" approach... And I'm not proficient enough on embedded platforms to replace core components like this.

You seem to know your way around busybox, do you know why I keep ending in ash, having to manually enter "bash" at each login (user AND root) even though I set /etc/passwd to /bin/bash ?
When I create another test user (w/ same /etc/passwd shell field) and copy the .bashrc to it, everything is fine, I can, from root, "su test" and I'm in BASH right away.
But when do the same for "user", I end up in ash, and have to enter "bash" :/ do you know why ?

Originally Posted by Nokia 5700 View Post
(...) I'm running bash 2.05b at the moment... :P (I know, but it's the only I found to show username and hostname...)(...)
? All versions of BASH take escape sequences for displaying those infos in the prompt. Try
Code:
PS1="\u@\h \W> "

Originally Posted by mesho123 View Post
where i can change the color of background and color of text ?
In your X-term's prefs.

Last edited by xaccrocheur; 2011-08-17 at 17:02.
 
Reply


 
Forum Jump


All times are GMT. The time now is 14:18.