I've searched previously for a way to echo all the commands in a bash script.
Today i found it on a asp page of all places:
set -o verbose #echo on
set +o verbose #echo off
If you want to do it once to debug a script you can also do:
bash -x your_script.sh
Showing posts with label bash. Show all posts
Showing posts with label bash. Show all posts
Saturday, 22 November 2008
Saturday, 11 October 2008
my bash setup
Here are some things I put in ~/.bashrc or /etc/bash.bashrc to make my life easier:
# When using bash, I use ctrl+r a lot to find commands I executed recently.
# I found that I remember my commands for much longer than bash does,
# so I increased my bash's memory:
export HISTFILESIZE=3000 # the bash history should save 3000 commands
export HISTCONTROL=ignoredups # don't put duplicate lines in the history.
export HISTCONTROL=ignoreboth # ignore same sucessive entries.
# (from http://www.novell.com/coolsolutions/tools/17142.html)
# I like to have a colour prompt with my user, the machine I'm on and the full
# path. Its a bit long so I put it on 2 lines.
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;33m\]\w\[\033[00m\]>\n\$ '
# enable bzr command auto completion
. /opt/bzr/bzr.current/contrib/bash/bzr.simple
# bzr aliasses
alias bt='./bzr --no-plugins selftest'
alias bd='bzr diff'
alias bl='bzr log'
alias bp='bzr pull -v |less'
alias bm='bzr missing |less'
alias bs='bzr status'
# bzr functions, which cant be done by alias or bzr's alias
bh(){
#the $@ inserts all the parameters you pass in
bzr help "$@" |less
}
bcd(){
bzr cdiff "$@" | less -R
}
# When using bash, I use ctrl+r a lot to find commands I executed recently.
# I found that I remember my commands for much longer than bash does,
# so I increased my bash's memory:
export HISTFILESIZE=3000 # the bash history should save 3000 commands
export HISTCONTROL=ignoredups # don't put duplicate lines in the history.
export HISTCONTROL=ignoreboth # ignore same sucessive entries.
# (from http://www.novell.com/coolsolutions/tools/17142.html)
# I like to have a colour prompt with my user, the machine I'm on and the full
# path. Its a bit long so I put it on 2 lines.
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;33m\]\w\[\033[00m\]>\n\$ '
# enable bzr command auto completion
. /opt/bzr/bzr.current/contrib/bash/bzr.simple
# bzr aliasses
alias bt='./bzr --no-plugins selftest'
alias bd='bzr diff'
alias bl='bzr log'
alias bp='bzr pull -v |less'
alias bm='bzr missing |less'
alias bs='bzr status'
# bzr functions, which cant be done by alias or bzr's alias
bh(){
#the $@ inserts all the parameters you pass in
bzr help "$@" |less
}
bcd(){
bzr cdiff "$@" | less -R
}
Subscribe to:
Posts (Atom)