[maemo-users] OS2008: .bashrc or .bash_profile?

From: Frantisek Dufka dufkaf at seznam.cz
Date: Thu Dec 13 11:04:48 EET 2007
Laurent MARTIN wrote:
> Any idea on how I could simulate .bashrc, specially 'alias' command?
> TIA.
> 

Busybox shell (ash) is pretty good, you need bash only for bash-isms. 
 From you post it looks like you don't need bash at all. Maybe most 
people wanting bash on device don't realize busybox ash is good enough 
(and possibly faster and less memory hungry). Aliases work too of 
course, it is standard Bourne shell. There is also tab completion and 
'normal' line editing.

As for .bashrc you can have it working with ash too. Just create 
~/.profile with something like:

# ~/.profile: executed by Bourne-compatible login shells.

if [ -f ~/.bashrc ]; then
   . ~/.bashrc
fi

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11
export PATH

mesg n


and ~/.bashrc

# ~/.bashrc: executed by bash(1) for non-login shells.

export PS1='\h:\w\$ '
umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
# export LS_OPTIONS='--color=auto'
# eval "`dircolors`"
# alias ls='ls $LS_OPTIONS'
# alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'


and it works. You can also set ENV to ~/.bashrc to have it read for 
every shell (not just login shell from .profile)
export ENV=~/.bashrc

Frantisek

More information about the maemo-users mailing list