X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;ds=inline;f=bashrc;h=3e6cc3aa644f0dc7f9c2937ed7e8ec261d5349c7;hb=856983cd510a04e27d441990c73f04e4b47e162f;hp=b2af3d5df2793a9d8c7816e1d99ba7fdca6686c2;hpb=576c6cdbf5b17938915ad3be3ec392c1d69e612d;p=scripts.git diff --git a/bashrc b/bashrc index b2af3d5..3e6cc3a 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 @@ -335,6 +339,16 @@ function dt () { [[ ${NETUP_HISTORY} ]] || NETUP_HISTORY="${HOME}/.netup_history" function netup () { + if [[ $(ps auxwww | grep dhclient | grep -v grep) ]]; then + echo "There is already a dhcp client running." >&2 + return 1 + fi + + if [[ $(ps auxwww | grep wpa_supplicant | grep -v grep) ]]; 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}) @@ -344,9 +358,8 @@ function netup () { echo ${ARGS} > ${NETUP_HISTORY} fi - if [[ $(ps auxwww | grep dhclient | grep -v grep) ]]; then - echo "There is already a dhcp client running." >&2 - return 1 + if [[ -n "${PRIVATE_INTERFACE_DEFINITION}" ]]; then + ARGS="-i ${PRIVATE_INTERFACE_DEFINITION} ${ARGS}" fi echo "Executing ${VT_GREEN_FG}[sudo ifup ${ARGS}]${VT_RESET}" @@ -372,6 +385,11 @@ function netdown () { # Otherwise, use the standard ifdown ARGS="$@" fi + + if [[ -n "${PRIVATE_INTERFACE_DEFINITION}" ]]; then + ARGS="-i ${PRIVATE_INTERFACE_DEFINITION} ${ARGS}" + fi + echo "Executing sudo ${VT_GREEN_FG}[ifdown ${ARGS}]${VT_RESET}" sudo ifdown ${ARGS} } @@ -832,7 +850,7 @@ alias finddup='finddup -p' # # git clone http://fleuret.org/git/selector/ -. bash-selector.sh +source bash-selector.sh --hist --cd ###################################################################### # And we avoid to put in the history the use of the selector, which we