X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=bashrc;h=f3d033aa8c266aa4a683a091725ed4829a5d286e;hb=e2f53975cc8e22c351a9b8095f88320cc1c40db2;hp=cca943d8ecb89e55cbfda9cbde15c81827074c69;hpb=f178ad4d130439b1b63e90871bfbb571cadb02f8;p=scripts.git diff --git a/bashrc b/bashrc index cca943d..f3d033a 100644 --- a/bashrc +++ b/bashrc @@ -50,6 +50,10 @@ shopt -s histappend [[ ${TERM} == "dumb" ]] || [ ! -t 0 ] && return +# Remove the annoying beeps in console + +setterm -blength 0 + ###################################################################### ## The interactive part @@ -166,8 +170,8 @@ function ua () { case "$1" in - *.tgz|*.tar.gz) - tar zxvf "$1" + *.tgz|*.tar.gz|*.tbz|*.tar.bz2) + tar xvf "$1" ;; *.rar) @@ -288,15 +292,20 @@ function map () { ## variables function pho () { - PHO_BIN=$(which pho) TEMP=$(mktemp /tmp/pho.XXXXXXX) - ${PHO_BIN} "$@" | tee ${TEMP} + $(which pho) "$@" | tee ${TEMP} PHO_NOTE_1=$(grep ^"Note 1: " ${TEMP} | sed -e "s/^[^:]*: //") PHO_NOTE_2=$(grep ^"Note 2: " ${TEMP} | sed -e "s/^[^:]*: //") PHO_NOTE_3=$(grep ^"Note 3: " ${TEMP} | sed -e "s/^[^:]*: //") PHO_NOTE_R90=$(grep ^"Rotate 90 \(CW\): " ${TEMP} | sed -e "s/^[^:]*: //") PHO_NOTE_R180=$(grep ^"Rotate 180: " ${TEMP} | sed -e "s/^[^:]*: //") PHO_NOTE_R270=$(grep ^"Rotate -90 \(CCW\): " ${TEMP} | sed -e "s/^[^:]*: //") + [[ "${PHO_NOTE_1}" ]] || unset PHO_NOTE_1 + [[ "${PHO_NOTE_2}" ]] || unset PHO_NOTE_2 + [[ "${PHO_NOTE_3}" ]] || unset PHO_NOTE_3 + [[ "${PHO_NOTE_R90}" ]] || unset PHO_NOTE_R90 + [[ "${PHO_NOTE_R180}" ]] || unset PHO_NOTE_R180 + [[ "${PHO_NOTE_R270}" ]] || unset PHO_NOTE_R270 \rm ${TEMP} } @@ -335,19 +344,26 @@ function dt () { [[ ${NETUP_HISTORY} ]] || NETUP_HISTORY="${HOME}/.netup_history" function netup () { - if [[ $(ps auxwww | grep dhclient | grep -v grep) ]]; then + if [[ $(\ifconfig -s | grep -v ^"(Iface|lo) ") ]]; then + echo "There is already interface(s) up." >&2 + return 1 + fi + + if [[ $(\ps -C dhclient | tail -n +2) ]]; then echo "There is already a dhcp client running." >&2 return 1 fi - if [[ $(ps auxwww | grep wpa_supplicant | grep -v grep) ]]; then + if [[ $(\ps -C wpa_supplicant | tail -n +2) ]]; then echo "There is already a wpa_supplicant running." >&2 return 1 fi if [[ ! "$@" ]] && [[ -s ${NETUP_HISTORY} ]]; then - # If we have no argument and there is a .netup_history, use it - ARGS=$(cat ${NETUP_HISTORY}) + echo "netup " >&2 + return 1 + # # If we have no argument and there is a .netup_history, use it + # ARGS=$(cat ${NETUP_HISTORY}) else # Otherwise uses the given arguments, and store them ARGS="$@"