Source

dotfiles / .bashrc.d / 05_functions.sh

Full commit
#!/bin/bash 
 
  __bash_rc_prompt_command() {
    builtin history -a
    HISTFILESIZE=$HISTFILESIZE
    builtin history -c
    builtin history -r
  }


  history() {
    __bash_rc_prompt_command
    builtin history "$@"
  }

  fu() {
    local CMD=$(fc -ln -1)
    local SUDO_CMD="sudo $CMD"
    $SUDO_CMD
    builtin history -s $SUDO_CMD
  }

  ProgramExist "pacman" && {
    pacman() {
     PACMAN=/usr/bin/pacman
     ProgramExist "pacman-color" && \
         PACMAN=/usr/bin/pacman-color
     case $1 in
         -S | -S[^sih]* | -R* | -U*)
             /usr/bin/sudo $PACMAN "$@" ;;
         *)
             $PACMAN "$@" ;;
     esac
    }
  }

  ProgramExist "yaourt" && {
    yaourt() {
     case $1 in
         -S | -S[^sih]* | -R* | -U*)
             /usr/bin/sudo /usr/bin/yaourt "$@" ;;
         *)
             /usr/bin/yaourt "$@" ;;
     esac
    }
  }


  ProgramExist "rdesktop" && {

      rdp() {

	 (rdesktop -u admolllun -r disk:MAGIC=${HOME} -N -g1900x1000 -k sv "$@") >/dev/null 2>&1 &
      }
  }

  ProgramExist "tmux" && [ "$(uname)" = "SunOS" ] && {

      tmux() {
        TERM=xtermc $( which tmux ) -f .tmux.conf "$@"
      }

  }

#EOF