WaZaRWiki : BashTips

GaelReignier :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register :: Hosted by: eNiX

Revision [36423]

Most recent edit made on 2012-04-24 12:44:22 by GaelReignier

Additions:

Loop through the content of a folder and display the SVN URL:

for i in `ls -1` ; do echo -e $i `svn info $i |grep URL |gawk '{print $2}'`; done;




Revision [393]

Edited on 2010-05-12 12:15:55 by GaelReignier

Additions:

My new bash profile

function exit_status {
EXIT_STATUS="$?"
BOLD="\[\033[1m\]"
RED="\[\033[1;31m\]"
GREEN="\[\e[32;1m\]"
BLUE="\[\e[34;1m\]"
OFF="\[\033[m\]"

# User specific aliases and functions
# set prompt: ``username@hostname time :/directory $
PS1="[\u@\h \[\033[00;36m\]\t\[\033[00m\] :\[\033[01;37m\]\w\[\033[00m\]"
if [ "${EXIT_STATUS}" -eq 0 ]
then
PS1="${PS1} - ${GREEN}$EXIT_STATUS${OFF}]"
else
PS1="${PS1} - ${RED}$EXIT_STATUS${OFF}]"
fi
case `id -u` in
0) PS1="${PS1}# ";;
*) PS1="${PS1}$ ";;
esac
}
PROMPT_COMMAND=exit_status




Revision [392]

Edited on 2010-05-12 11:24:31 by GaelReignier

Additions:
Threads about tweaking your bash prompt: http://stackoverflow.com/questions/103857/what-is-your-favorite-bash-prompt




Revision [391]

Edited on 2010-05-12 11:19:22 by GaelReignier

Additions:
echo "The latest exit status is $?"




Revision [256]

Edited on 2008-12-18 14:32:37 by GaelReignier

Additions:
ITTips





Revision [255]

Edited on 2008-12-18 14:32:09 by GaelReignier

Additions:
set -x # to put the debug mde on
set +x# to put the debug mode off


Deletions:
on: set -x
off: set +x




Revision [254]

Edited on 2008-12-18 14:31:36 by GaelReignier

Additions:
 
(bash)
%%(bash)


Deletions:
%%(language-ref)




Revision [232]

Edited on 2008-12-03 16:20:15 by GaelReignier

Additions:
ctrl+s will lock the term
ctrl+q will unlock the term
My .bash_profile for the prompt line
# set prompt: ``username@hostname time :/directory $ ''
PS1="[\u@\h \[\033[00;36m\]\t\[\033[00m\] :\[\033[01;37m\]\w\[\033[00m\]]" 
case `id -u` in
	  0) PS1="${PS1}# ";;
	  *) PS1="${PS1}$ ";;
esac

Having a pretty bash: http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
Non executed bash:
[gael@unennennium 12:38:53 :01;37m~/Documents/Lonres/Documentation/PHP]$




Revision [197]

Edited on 2008-08-22 11:47:48 by GaelReignier

Additions:
Debug mode:
on: set -x
off: set +x




Revision [143]

Edited on 2008-06-18 21:36:28 by GaelReignier

Additions:


#!/bin/sh
# this is a comment
echo "The number of arguments is $#"
echo "The arguments are $*"
echo "The first is $1"
echo "My process number is $$"
echo "Enter a number from the keyboard: "
read number
echo "The number you entered was $number"




Revision [77]

Edited on 2008-05-14 13:45:10 by GaelReignier

Additions:
Exit status: http://tldp.org/LDP/abs/html/exit-status.html


Deletions:
Exit status:




Revision [76]

The oldest known version of this page was edited on 2008-05-14 13:44:52 by GaelReignier
Exit status:
0 is good and you can retrieve the last exit status using echo $?
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki
Page was generated in 0.2632 seconds