. /etc/bash_completion # .bashrc function ff() { find . -name '*'$1'*' ; } # find a file function fe() { find . -name '*'$1'*' -exec $2 {} \; ; } # find a file and run $2 on it function fstr() # find a string in a set of files { if [ "$#" -gt 2 ]; then echo "Usage: fstr \"pattern\" [files] " return; fi SMSO=$(tput smso) RMSO=$(tput rmso) find . -type f -name "${2:-*}" -print | xargs grep -sin "$1" | \ sed "s/$1/$SMSO$1$RMSO/gI" } # are we an interactive shell? if [ "$PS1" ]; then if [ -x /usr/bin/tput ]; then if [ "x`tput kbs`" != "x" ]; then # We can't do this with "dumb" terminal stty erase `tput kbs` elif [ -x /usr/bin/wc ]; then if [ "`tput kbs|wc -c `" -gt 0 ]; then # We can't do this with "dumb" terminal stty erase `tput kbs` fi fi fi case $TERM in *term*) PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"' TTYNAME=$(tty | sed -e 's/^\/dev\///'); lssum() { totale=0; for byte in $(ls -l|grep "^-" |cut -c30-41); do let totale=$totale+$byte; done; totalemsg=$(echo -e "scale=2 \n$totale/104857 \nquit" |bc); echo -n "$totalemsg" } CL1="\[\033[0;36m\]" # Azzurro CL2="\[\033[0;32m\]" # Verde CL3="\[\033[0;36m\]" # Cyan CL4="\[\033[0;37m\]" # Bianco CL5="\[\033[1;33m\]" # Giallo CL6="\[\033[0;34m\]" # Blu CL7="\[\033[0m\]" # grigio CL8="\[\033[0;1;31m\]" # grigio if [ "$UID" = "0" ]; then CL2="\[\033[0;31m\]" # Rosso fi PS1="$CL2-($CL8\u$CL3 on $CL3\h$CL2)-($CL1\@ \d$CL2)-($CL1$TTYNAME$CL2)-($CL1\$(lssum)Mb$CL2)\n--($CL8\w$CL2)$CL2\n---> $CL7" #export PS1 ;; *) ;; esac [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " if [ "x$SHLVL" != "x1" ]; then # We're not a login shell for i in /etc/profile.d/*.sh; do if [ -x $i ]; then . $i fi done fi fi # This one allows you to do "cd ...." instead of "cd ../../.." cd() { if echo $1 | fgrep ... > /dev/null ; then builtin cd $( echo -e "${1//\//\\n}" \ | sed 's/^\.\(\.*\)$/\1/; /^\.*$/ s@\.@../@g; s@^\([\./]*\)/$@\1@' \ | tr '\n' '/' ) else builtin cd "$@" fi } ascii() { inizio=${1:-32} fine=${2:-$inizio} for i in `seq $inizio $fine` do echo -e $i\\t\\$(echo 'obase=8;'$i|bc) done } path() { echo -e "${PATH//:/\\n}" } setterm -blength 0 # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi