# Check for an interactive session [ -z "$PS1" ] && return alias ls='ls --color=auto' alias la='ls -a' HISTCONTROL=$HISTCONTROL${HISTCONTROL+:}ignoredups # ... or force ignoredups and ignorespace HISTCONTROL=ignoreboth # PS1='[\u@\h \W]\$ ' bash_prompt_command() { # How many characters of the $PWD should be kept local pwdmaxlen=25 # Indicate that there has been dir truncation local trunc_symbol=".." local dir=${PWD##*/} pwdmaxlen=$(( ( pwdmaxlen < ${#dir} ) ? ${#dir} : pwdmaxlen )) NEW_PWD=${PWD/#$HOME/\~} local pwdoffset=$(( ${#NEW_PWD} - pwdmaxlen )) if [ ${pwdoffset} -gt "0" ] then NEW_PWD=${NEW_PWD:$pwdoffset:$pwdmaxlen} NEW_PWD=${trunc_symbol}/${NEW_PWD#*/} fi } bash_prompt() { case $TERM in xterm*|rxvt*) local TITLEBAR='\[\033]0;\u:${NEW_PWD}\007\]' ;; *) local TITLEBAR="" ;; esac local NONE="\[\033[0m\]" # unsets color to term's fg color local black='\e[0;30m' local blue='\e[0;34m' local green='\e[0;32m' local cyan='\e[0;36m' local red='\e[0;31m' local purple='\e[0;35m' local brown='\e[0;33m' local lightgray='\e[0;37m' local darkgray='\e[1;30m' local lightblue='\e[1;34m' local lightgreen='\e[1;32m' local lightcyan='\e[1;36m' local lightred='\e[1;31m' local lightpurple='\e[1;35m' local yellow='\e[1;33m' local white='\e[1;37m' local nc='\e[0m' # regular colors local K="\[\033[0;30m\]" # black local R="\[\033[0;31m\]" # red local G="\[\033[0;32m\]" # green local Y="\[\033[0;33m\]" # yellow local B="\[\033[0;34m\]" # blue local M="\[\033[0;35m\]" # magenta local C="\[\033[0;36m\]" # cyan local W="\[\033[0;37m\]" # white # empahsized (bolded) colors local EMK="\[\033[1;30m\]" local EMR="\[\033[1;31m\]" local EMG="\[\033[1;32m\]" local EMY="\[\033[1;33m\]" local EMB="\[\033[1;34m\]" local EMM="\[\033[1;35m\]" local EMC="\[\033[1;36m\]" local EMW="\[\033[1;37m\]" # background colors local BGK="\[\033[40m\]" local BGR="\[\033[41m\]" local BGG="\[\033[42m\]" local BGY="\[\033[43m\]" local BGB="\[\033[44m\]" local BGM="\[\033[45m\]" local BGC="\[\033[46m\]" local BGW="\[\033[47m\]" local UC=$C #$lightpurple # user's color [ $UID -eq "0" ] && UC=$R # root's color #PS1="$TITLEBAR ${EMK}[${UC}\u${EMR}@${UC}\h ${EMB}\${NEW_PWD}${EMK}]${UC}\\$ ${NONE}" PS1="$TITLEBAR ${EMK}[${UC}\u ${EMB}\${NEW_PWD}${EMK}]${UC}\\$ ${NONE}" #PS1="\[\033[38;5;7m\][\A]\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[3[38;5;6m\]\u\[$(tput sgr0)\]\[\033[38;5;1m\]@\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput bold)\]\[$(tput sgr0)\]\[\033[38;5;12m\]\W\[$(tput sgr0)\] >" # without colors: PS1="[\u@\h \${NEW_PWD}]\\$ " # extra backslash in front of \$ to make bash colorize the prompt } PROMPT_COMMAND=bash_prompt_command bash_prompt unset bash_prompt # enable bash completion in interactive shells if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi #PS1="\[\033[38;5;7m\][\A]\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;6m\]\u\[$(tput sgr0)\]\[\033[38;5;1m\]@\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput bold)\]\[$(tput sgr0)\]\[\033[38;5;39m\]\w\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;15m\] >\[$(tput sgr0)\] " #PS1="\[\033[0;37m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[\A]$(if [[ ${EUID} == 0 ]]; then echo '\@ \[\033[0;31m\]\u\[\033[0;37m\]@\[\033[0;96m\]\h'; else echo ' \[\033[0;96m\]\u\[\033[38;5;1m\]@ '; fi)\[\033[0;37m\]\342\224\200[\[\033[0;32m\]\w\[\033[0;37m\]]\n\[\033[0;37m\]\342\224\224\342\224\200\342\224\200\076 \[\033[0m\]" #PS1="\[\033[0;37m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[0;31m\]\u\[\033[0;37m\]@\[\033[0;96m\]\h'; else echo '\[\033[0;33m\]\u\[\033[0;37m\]@\[\033[0;96m\]\h'; fi)\[\033[0;37m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;37m\]]\n\[\033[0;37m\]\342\224\224\342\224\200\342\224\200\076 \[\033[0m\]" PS1="\[\033[0;37m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[\A]$(if [[ ${EUID} == 0 ]]; then echo '\@ \[\033[0;31m\]\u\[\033[0;37m\]@\[\033[0;96m\]\h'; else echo ' \[\033[0;96m\]\u\[\033[38;5;1m\]@ '; fi)\[\033[0;37m\]\342\224\200[\[\033[0;32m\]\w\[\033[0;37m\]]\n\[\033[0;37m\]\342\224\224\342\224\200\342\224\200\076 \[\033[0m\]" ##################################### #------------------------------------------//// # Colors: #------------------------------------------//// black='\e[0;30m' blue='\e[0;34m' green='\e[0;32m' cyan='\e[0;36m' red='\e[0;31m' purple='\e[0;35m' brown='\e[0;33m' lightgray='\e[0;37m' darkgray='\e[1;30m' lightblue='\e[1;34m' lightgreen='\e[1;32m' lightcyan='\e[1;36m' lightred='\e[1;31m' lightpurple='\e[1;35m' yellow='\e[1;33m' white='\e[1;37m' nc='\e[0m' export LANG="it_IT.UTF-8" export LC_COLLATE="C" ############################################################## ############################################################## #echo -e '\e[H\e[2J' #echo #echo #echo -e ' \e[1;36m` ' #echo -e ' \e[1;36m-: ' #echo -e ' \e[1;36m.//: ' #echo -e ' \e[1;36m`////- ' #echo -e ' \e[1;36m`://///. ' #echo -e ' \e[1;36m:///////. ' #echo -e ' \e[1;36m-/////////. ' #echo -e ' \e[1;36m`://////////` ' #echo -e ' \e[1;36m-:..://///////` ' #echo -e ' \e[1;36m-////:::////////` ' #echo -e ' \e[1;36m-/////////////////` ' #echo -e ' \e[1;36m-//////////++++/////` ' #echo -e ' \e[1;36m-////\e[0;36m++++oooooooooo+++. ' #echo -e ' \e[0;36m-/+++oooooooooooooooooo+. ' #echo -e ' \e[0;36m:+oooooooo+-..-/+oooooooo+. ' #echo -e ' \e[0;36m`/ooooooooo:` .+oooooooo+. ' #echo -e ' \e[0;36m`/ooooooooo/ .ooooooooo+- ' #echo -e ' \e[0;36m`/oooooooooo` /oooooo++++- ' #echo -e ' \e[0;36m`+ooooooooooo` :oooooo++/-:. ' #echo -e ' \e[0;36m.+ooooooooooo+` :+oooooooo+/-` ' #echo -e ' \e[0;36m.+oooooo++/:-.` `..-:/++ooooo+: ' #echo -e ' \e[0;36m.+oo++/-.` `.-:++ooo: ' #echo -e ' \e[0;36m-++/-.` \e[0;36m`-:++/` ' #echo -e ' \e[0;36m-++/-.` \e[0;36m`-:++/` ' #echo -e ' \e[0;36m.:.` .-- ' #echo #echo ##------------------------------------------//// # System Information: #------------------------------------------//// #archey3 echo screenfetch echo echo echo -ne "${red}Today is:\t\t${lightpurple}" `date`; echo "" echo -e "${red}Kernel Information: \t${lightpurple}" `uname -smr` #echo -e "${green}"; cal -3 echo '' echo '' ############################################################## ############################################################## alias ll='ls -l' alias open='/usr/bin/xdg-open' alias vi='vim' # Scorciatoie shell bind '"\e[A": history-search-backward' bind '"\e[B": history-search-forward' # Fluent path PATH=/opt/fluent/bin/:$PATH ; export PATH # Matlab PATH=/opt/matlab/bin:$PATH ; export PATH ## PATH=/home/marco/projects/tmp/bin:$PATH ; export PATH ####### FUNCTION ################################# extract() { if [ -f "$1" ] ; then case "$1" in *.tar.bz2) tar xjf "$1" ;; *.tar.gz) tar xzf "$1" ;; *.tar.Z) tar xzf "$1" ;; *.bz2) bunzip2 "$1" ;; *.rar) unrar x "$1" ;; *.gz) gunzip "$1" ;; *.jar) unzip "$1" ;; *.tar) tar xf "$1" ;; *.tbz2) tar xjf "$1" ;; *.tgz) tar xzf "$1" ;; *.zip) unzip "$1" ;; *.Z) uncompress "$1" ;; *) echo "'$1' cannot be extracted." ;; esac else echo "'$1' is not a file." fi } # CP con progress bar cp_p() { set -e strace -q -ewrite cp -- "${1}" "${2}" 2>&1 \ | awk '{ count += $NF if (count % 10 == 0) { percent = count / total_size * 100 printf "%3d%% [", percent for (i=0;i<=percent;i++) printf "=" printf ">" for (i=percent;i<100;i++) printf " " printf "]\r" } } END { print "" }' total_size=$(stat -c '%s' "${1}") count=0 }