DaemonForums  

Go Back   DaemonForums > Miscellaneous > Off-Topic

Off-Topic Everything else.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 31st May 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default What does your .*shrc file look like?

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
site_shrc defines things specific to the current machine, I find it useful for adjusting the environment variables:

${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''.
Reply With Quote
  #2   (View Single Post)  
Old 21st February 2012
daemonfowl daemonfowl is offline
bsdstudent
 
Join Date: Jan 2012
Location: DaemonLand
Posts: 834
Default

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/"
lol .. how lazy of me ! ..
Reply With Quote
  #3   (View Single Post)  
Old 21st February 2012
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Tcpdump Spy
 
Join Date: Apr 2008
Location: Netherlands
Posts: 2,243
Default

I use tcsh:

https://bitbucket.org/Carpetsmoker/c...tcsh/csh.cshrc
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #4   (View Single Post)  
Old 21st February 2012
daemonfowl daemonfowl is offline
bsdstudent
 
Join Date: Jan 2012
Location: DaemonLand
Posts: 834
Default

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 ..
Reply With Quote
  #5   (View Single Post)  
Old 21st February 2012
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Tcpdump Spy
 
Join Date: Apr 2008
Location: Netherlands
Posts: 2,243
Default

Quote:
Originally Posted by daemonfowl View Post
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' ..
The reason I use tcsh is simply "because it was there first". It's the default on FreeBSD and the first shell I dived in to.
I'm sure other shells work equally well if not better, but tcsh works well enough for me, and I don't want to invest the time and energy learning all the new keybinds, tricks, configuration options, etc. The cost/benefit ratio simply isn't large enough.

Using (t)csh for shell scripting is a probably not a good idea, as outlined in the article you mentioned, but that's something very different than using it as an interactive shell.
the biggest issue is the limited stdout/stderr redirection. This is usually not a problem, but can be annoying at times.
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #6   (View Single Post)  
Old 21st February 2012
daemonfowl daemonfowl is offline
bsdstudent
 
Join Date: Jan 2012
Location: DaemonLand
Posts: 834
Default

Thanks Carpetsmoker .. good energy-saving strategy .. ..
gist of it : tcsh harmless as interactive shell ..
Reply With Quote
  #7   (View Single Post)  
Old 21st February 2012
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Tcpdump Spy
 
Join Date: Apr 2008
Location: Netherlands
Posts: 2,243
Default

"mostly harmless" anyway.
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #8   (View Single Post)  
Old 21st February 2012
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

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.
Reply With Quote
  #9   (View Single Post)  
Old 22nd February 2012
daemonfowl daemonfowl is offline
bsdstudent
 
Join Date: Jan 2012
Location: DaemonLand
Posts: 834
Default

Hi IdOp ! good choice for good reasons ..
I'd like if possible that you'd share parts of your shell profile .. time-saving aliases .. ;-) ..
Reply With Quote
Old 22nd February 2012
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

Quote:
Originally Posted by daemonfowl View Post
I'd like if possible that you'd share parts of your shell profile .. time-saving aliases .. ;-) ..
Can do, but it may take a while as I'll have to edit it for anonymity first. Also fair warning, its messy, so if there's any value it would be as an example of what not to do.
Reply With Quote
Old 22nd February 2012
daemonfowl daemonfowl is offline
bsdstudent
 
Join Date: Jan 2012
Location: DaemonLand
Posts: 834
Default

it's alright .. please do when you can ..
Reply With Quote
Old 23rd February 2012
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

@daemonfowl, OK I've cleaned up the dirty laundry a bit and attached the files. Hopefully there is something humorous or useful in there.
Attached Files
File Type: tgz profile_rc.tgz (8.4 KB, 126 views)
Reply With Quote
Old 23rd February 2012
daemonfowl daemonfowl is offline
bsdstudent
 
Join Date: Jan 2012
Location: DaemonLand
Posts: 834
Default

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 .. :-)
Reply With Quote
Old 23rd February 2012
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

You're welcome, glad if you found something useful under the high level of idiosyncratic noise.
Reply With Quote
Reply

Tags
shells

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT. The time now is 10:48 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick