![]() |
|
||||
|
What does your shells initialization file look like?
On my systems, the individual shells own profile/shrc's just source this through . or ENV. $HOME/.${USER}_shrc Code:
# vim: set ft=sh :
# default file permissions -rw------- / drwx------
umask 077
# set my standard environment settings
PATH="/bin:/sbin:/usr/bin:/usr/sbin"; export PATH
# locale related settings
TZ='Etc/UTC'; export TZ # my time zone
LANG='en_US.UTF-8'; export LANG # language.encoding
# some programs require us to set LC_ALL manually as well.
LC_ALL='en_US.UTF-8'; export LC_ALL
MM_CHARSET='UTF-8'; export MM_CHARSET
BLOCKSIZE='M'; export BLOCKSIZE # prefer megabytes over 512 byte blocks
# set my pager
if [ -x /usr/bin/less ]; then
PAGER='/usr/bin/less'; export PAGER
LESS='-FiJqX'; export LESS # default options to less
else
PAGER="more"; export PAGER
fi
# set my default editor, on order of preference and create aliases
if [ -x /usr/local/bin/vim ]; then
EDITOR='/usr/local/bin/vim'; export EDITOR
VISUAL='/usr/local/bin/vim'; export VISUAL
if [ -x /usr/local/bin/view ]; then
# I prefer Vim to Vi when 'view'ing a file
alias view='/usr/local/bin/view'
fi
elif [ -x /usr/bin/vi ]; then
EDITOR='/usr/bin/vi'; export EDITOR
VISUAL='/usr/bin/vi'; export VISUAL
# on some systems where vim is not installed, I tend to type vim
alias vim='/usr/bin/vi'
elif [ -x /usr/bin/mg -o /usr/local/bin/mg ]; then
# Micro GNU Emacs is
EDITOR="`which mg`"; export EDITOR
VISUAL="`which mg`"; export VISUAL
alias microemacs='mg'
fi
case `uname -s` in
'FreeBSD') isFreeBSD=1
LSCOLORS='CxGxxxxxBxexExcxdx'; export LSCOLORS
;; # FreeBSD
'OpenBSD') isOpenBSD=1;;
'NetBSD') isNetBSD=1;;
'Linux') isLinux=1;;
'Unix') isUnix=1;;
esac
case `basename $SHELL` in
'sh') # older versions of the bourne shell lack line editing (i.e. < sys 3)
[ $isFreeBSD ] || [ $isOpenBSD ] ||
[ $isNetBSD ] || [ $isLinux ] && set -o emacs
# set prompt
PS1="`hostname -s`$ "; export PS1
;; # sh
'bash')
# prompt is: [ user@host:pwd ]$
PS1="[ \u@\h:\w ]$ "; export PS1
set -o emacs
;; # bash
'ksh'| 'ksh93'| 'pdksh')
# my standard issue prompt
PS1="$USER@`hostname -s`-$ "; export PS1
set -o emacs
;; # ksh family
'zsh') # set my various options
HISTFILE=~/.histfile
HISTSIZE=100
SAVEHIST=300
setopt appendhistory autocd extendedglob
# dont' beep !
unsetopt beep
# emacs bindings
bindkey -e
zstyle :compinstall filename "$HOME/.zshrc"
autoload -Uz compinit
compinit
# COLORS
fg_green=$'%{\e[0;32m%}'
fg_blue=$'%{\e[0;34m%}'
fg_cyan=$'%{\e[0;36m%}'
fg_red=$'%{\e[0;31m%}'
fg_brown=$'%{\e[0;33m%}'
fg_purple=$'%{\e[0;35m%}'
fg_light_gray=$'%{\e[0;37m%}'
fg_dark_gray=$'%{\e[1;30m%}'
fg_light_blue=$'%{\e[1;34m%}'
fg_light_green=$'%{\e[1;32m%}'
fg_light_cyan=$'%{\e[1;36m%}'
fg_light_red=$'%{\e[1;31m%}'
fg_light_purple=$'%{\e[1;35m%}'
fg_no_colour=$'%{\e[0m%}'
fg_white=$'%{\e[1;37m%}'
fg_black=$'%{\e[0;30m%}'
# I like color in my zsh prompt ;-)
PS1="$USER@%B%m%b${fg_green}$ ${fg_no_colour}"; export PS1
# display the (24h) time in the right-prompt`
RPS1="%T"; export RPS1
esac
#
# define some standard aliases for programs, should be fairly portable where
# said programs are installed.
#
alias bye="echo 'bye'; exit"
alias cls='clear'
alias pgr="$PAGER"
alias limeric='fortune /usr/share/games/fortune/limerick'
alias gcc='gcc -Wall -W -Wpointer-arith -Wbad-function-cast -std=c99'
alias gcc_wall= 'gcc -Wall -Wpointer-arith -Wcast-qual -Wcast-align \
-Wconversion -Waggregate-return -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations \
-Wredundant-decls -Winline -Wnested-externs -std=c99 \
-march=i686 -pipe'
alias gcc_optimize='gcc -fforce-mem -fforce-addr -finline-functions \
-fstrength-reduce -floop-optimize -O3'
alias gcc_debug='gcc -ggdb3'
# this quick lint works on both FreeBSD and OpenBSD anyway (ansi mode)
alias lint='lint -cehzs'
# lint's -H option is not documented on FreeBSD but works on both FreeBSD and
# OpenBSD, dunno about other lints.
alias lint_ansi='lint -aaabcehHzs'
#
# define system specfic aliases for common commands
#
if [ $isFreeBSD ]; then
# The FreeBSD system seems to have been made by people that have an "Hey
# we've been using this command prompt for the past 30 years, let's tmake it
# comfortable!" approch... Thus it needs it's own set of aliases.
alias cp='cp -ivRL'
alias mv='mv -v'
alias ls='ls -FGH'
alias ll='ls -laFhHo'
alias la='ls -aFG'
alias rm='rm -d'
alias rmdir='rmdir -v'
# quick command to mute the sound system
alias mute='mixer pcm 0:0'
elif [ $isOpenBSD ]; then
alias cp='cp -iRL'
alias ls='ls -F'
alias ll='ls -laFho'
alias la='ls -aF'
alias rm='rm -d'
elif [ $isLinux ]; then
echo "No aliases set..."
else
#
# define fail safe aliases that should work on most systems
#
alias ll='ls -l'
alias la='la'
fi
# give a fortune cookie and the current date/time on login
[ -x /usr/games/fortune ] && /usr/games/fortune -aes
echo ''
echo ''; echo -n 'To days date is: '; date
#
# parse site local additions
#
. ${HOME}/.site_shrc
${HOME}/.site_shrc on this laptop: Code:
# vim: set ft=sh :
# TeX Live stuff
PATH="/usr/Programs/texlive/2007/bin/i386-freebsd:$PATH:/usr/local/bin:/usr/local/sbin:${HOME}/sh:${HOME}/bin"; export PATH
MANPATH="/usr/Programs/texlive/2007/texmf/doc/man:/usr/share/man:/usr/local/man:$MANPATH"; export MANPATH
INFOPATH="/usr/Programs/texlive/2007/texmf/doc/info:/usr/share/info:/usr/local/info:$INFOPATH"; export INFOPATH
# QT: needed in order to compile QT programs...
export QMAKESPEC='freebsd-g++'
export QTDIR='/usr/X11R6/include/'
# for NPM
export SVNROOT='<snip>'
# for sudo pkg_add
PACKAGEROOT="ftp://ftp13.us.FreeBSD.org/"; export PACKAGEROOT
alias paxhelp='paxhelp | pgr'
alias scp2v='scp -P <snip> -i ~/.ssh/<snip>'
alias ssh2v='ssh -p <snip> <snip>@vectra -i ~/.ssh/<snip>'
alias ssh2npm='<snip>'
alias gcj='gcj43'
# Our IP Address, doesn't work in older bourne shells
if [ -x /usr/bin/perl ]; then
MY_IP=$(ifconfig ath0 | grep 'inet' | awk '{print $2}')
fi
disclaimer: I've used FreeBSD since November 2005.
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
|||
|
Hi TerriP ! Thank you for sharing this !
I liked the fortune cookie on login .. I an a big fortune addict .. I remember I first encountered this on slackware as I remember I found something similar on dragonflyBSD .. nice tips from dru ... part of my profile aliases : Code:
alias r="mplayer http://srv3.electro-music.com:8500"
to listen to some cool ambient
alias ls="gls -F --color=always"
alias df="df -h"
alias bg="fbsetbg -f /home/bifrost/images.bifrost/zen_unix01.jpg"
alias f="fortune -s"
alias fl="fortune -l"
alias fo="fortune -o"
alias x="xinit /etc/X11/xinit/xinitrc"
alias gn="xinit /usr/local/bin/gnome-session"
alias p="cd /usr/ports/ && ls "
alias d="less pkg/DESCR"
alias da="less pkg/DESCR-main"
alias ftpgo="ftp ftp://ftp.fr.openbsd.org/pub/OpenBSD/"
|
|
|||
|
Thanks Carpetsmoker !
interesting profile .. what's more interesting to me as a new c learner : why are you using tcsh as default shell despite Barnett's 'Top Ten Reasons not to use the C shell' .. hopefully the topic of a future thread .. |
|
|||
|
Thanks Carpetsmoker .. good energy-saving strategy .. ..
gist of it : tcsh harmless as interactive shell .. |
|
||||
|
I started out with csh and tsch in my early Unix experience (SunOS) on machines where I worked, and initially continued with tcsh when I started using Unix-like on my own computer. Eventually though, I found it inevitable to have to deal with Bourne sh scripts in the sysadmin. It drove me nuts having to remember and switch between both types of shell syntax all the time, so I eventually decided to ditch the t/csh stuff, since Bourne was more powerful and inevitable. That's my take on it anyway: basically the KISS principle. YMMV and all that.
|
|
|||
|
Hi IdOp ! good choice for good reasons ..
I'd like if possible that you'd share parts of your shell profile .. time-saving aliases .. ;-) .. |
|
||||
|
Quote:
|
|
|||
|
it's alright .. please do when you can ..
|
|
|||
|
Thanks IdOp !! interesting .. specially the alias part which I could understand and will surely benefit from .. some other parts urge me to read more about .. :-)
|
![]() |
| Tags |
| shells |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP read file contents - Maximum file size | cksraj | Programming | 1 | 21st September 2009 11:38 AM |
| File system at more than 100% | michaelrmgreen | FreeBSD General | 4 | 28th July 2008 01:52 PM |
| file:/// | mfaridi | FreeBSD Security | 3 | 27th July 2008 02:18 PM |
| Help with tcpdump file | brokensilence | General software and network | 2 | 10th July 2008 03:45 PM |
| VSFTPd: pid file | kostromin | FreeBSD Ports and Packages | 0 | 4th July 2008 08:35 AM |