Added a visible warning when the RAID status is not "completed".
[scripts.git] / bashrc
diff --git a/bashrc b/bashrc
index dbacd63..d84d7c9 100644 (file)
--- 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)
@@ -335,22 +339,34 @@ function dt () {
 [[ ${NETUP_HISTORY} ]] || NETUP_HISTORY="${HOME}/.netup_history"
 
 function netup () {
+    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 -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 <interface>" >&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="$@"
         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
-    fi
-
-    if [[ -f "${HOME}/private/interfaces" ]]; then
-        ARGS="-i ${HOME}/private/interfaces ${ARGS}"
+    if [[ -n "${PRIVATE_INTERFACE_DEFINITION}" ]]; then
+        ARGS="-i ${PRIVATE_INTERFACE_DEFINITION} ${ARGS}"
     fi
 
     echo "Executing ${VT_GREEN_FG}[sudo ifup ${ARGS}]${VT_RESET}"
@@ -377,8 +393,8 @@ function netdown () {
         ARGS="$@"
     fi
 
-    if [[ -f "${HOME}/private/interfaces" ]]; then
-        ARGS="-i ${HOME}/private/interfaces ${ARGS}"
+    if [[ -n "${PRIVATE_INTERFACE_DEFINITION}" ]]; then
+        ARGS="-i ${PRIVATE_INTERFACE_DEFINITION} ${ARGS}"
     fi
 
     echo "Executing sudo ${VT_GREEN_FG}[ifdown ${ARGS}]${VT_RESET}"
@@ -841,7 +857,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