From d8b98ede933a4f4b6c77541e289b34cd184afa4d Mon Sep 17 00:00:00 2001 From: czoczo Date: Sun, 16 Mar 2025 21:47:08 +0100 Subject: [PATCH] changed install method, added uninstall --- .inputrc | 5 +++-- README.md | 36 ++++++++++++++++++++++--------- getbb.sh | 18 ++++++++++------ {.bshell => prompt}/bb.sh | 4 ++-- {.bshell => prompt}/git-prompt.sh | 0 removebb.sh | 5 +++++ 6 files changed, 48 insertions(+), 20 deletions(-) rename {.bshell => prompt}/bb.sh (95%) rename {.bshell => prompt}/git-prompt.sh (100%) create mode 100644 removebb.sh diff --git a/.inputrc b/.inputrc index 1c9160e..435ba03 100644 --- a/.inputrc +++ b/.inputrc @@ -1,4 +1,5 @@ -## arrow up +## BetterBash +# arrow up "\e[A":history-search-backward -## arrow down +# arrow down "\e[B":history-search-forward diff --git a/README.md b/README.md index 8579af2..28c0a9f 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ ## screenshot: ![alt text](https://git.cz0.cz/czoczo/BetterBash/raw/branch/master/screenshot.png "BetterBash screenshot") ## Features +- Rapid search history with up/down keyboard arrows - Username (highlighted if root) and hostname. - Unique avatar based on hostname (a bit like automatic avatars on StackOverflow), reduces the risk of terminal confusion. - Number of background processes. @@ -10,18 +11,33 @@ - Date and time. - Current directory. - Git status (if current directory inside git repository) -## Quick install: +## Install: +with curl ``` -URL='https://git.cz0.cz/czoczo/BetterBash/raw/branch/master/.bshell' && \ -DIR=~/.bshell && \ -CMD='[ -f ~/.bshell/bb.sh ] && . ~/.bshell/bb.sh' && \ -mkdir -p $DIR && \ -wget $URL/bb.sh -O $DIR/bb.sh && \ -wget $URL/git-prompt.sh -O $DIR/git-prompt.sh && \ -grep -q "$CMD" ~/.bashrc || echo "$CMD" >> ~/.bashrc && \ -source ~/.bashrc +curl https://cz0.cz/getbb | sh && . ~/.bashrc ``` -or just: +with wget ``` curl https://cz0.cz/getbb | sh && . ~/.bashrc ``` +with openssl (no dependencies needed) +``` +echo -e "GET /getbb HTTP/1.1\r\nHost: cz0.cz\r\nConnection: close\r\n\r\n" \ +| openssl s_client -quiet -connect cz0.cz:443 2>/dev/null \ +| sed '1,/^\r$/d' | sh && . ~/.bashrc +``` +## Uninstall: +with curl +``` +curl https://cz0.cz/removebb | sh && . ~/.bashrc +``` +with wget +``` +curl https://cz0.cz/removebb | sh && . ~/.bashrc +``` +with openssl (no dependencies needed) +``` +echo -e "GET /removebb HTTP/1.1\r\nHost: cz0.cz\r\nConnection: close\r\n\r\n" \ +| openssl s_client -quiet -connect cz0.cz:443 2>/dev/null \ +| sed '1,/^\r$/d' | sh && . ~/.bashrc +``` diff --git a/getbb.sh b/getbb.sh index 270443a..5a6e7df 100644 --- a/getbb.sh +++ b/getbb.sh @@ -1,8 +1,14 @@ -URL='https://git.cz0.cz/czoczo/BetterBash/raw/branch/master/.bshell' && \ -DIR=~/.bshell && \ -CMD='[ -f ~/.bshell/bb.sh ] && . ~/.bshell/bb.sh' && \ +#!/bin/bash +get_file() { + echo -e "GET /czoczo/BetterBash/raw/branch/master/$1 HTTP/1.1\r\nHost: git.cz0.cz\r\nConnection: close\r\n\r\n" \ + | openssl s_client -quiet -connect cz0.cz:443 2>/dev/null \ + | sed '1,/^\r$/d' +} + +DIR=~/.bb && \ +CMD="[ -f $DIR/bb.sh ] && . $DIR/bb.sh" && \ mkdir -p $DIR && \ -wget $URL/bb.sh -O $DIR/bb.sh && \ -wget $URL/git-prompt.sh -O $DIR/git-prompt.sh && \ +get_file /prompt/bb.sh && > $DIR/bb.sh && \ +get_file /prompt/git-prompt.sh > $DIR/git-prompt.sh && \ +get_file /.inputrc >> ~/.bb/.inputrc && \ grep -q "$CMD" ~/.bashrc || echo "$CMD" >> ~/.bashrc - diff --git a/.bshell/bb.sh b/prompt/bb.sh similarity index 95% rename from .bshell/bb.sh rename to prompt/bb.sh index ab71825..b13405e 100644 --- a/.bshell/bb.sh +++ b/prompt/bb.sh @@ -99,7 +99,7 @@ function __prompt_command() { LEFT="\n$BORDCOL\[\016\]$PR_ULCORNER$HBAR\[\017\]$WHITEB($USERCOL$USER$WHITEB@$GREEN\h:$cur_tty$WHITEB)$BORDCOL$HBAR$HBAR$WHITEB($CH$WHITEB)$BGPROCCOL" - RIGHT="$EXIT$BORDCOL$HBAR$HBAR$HBAR$WHITEB($YELLOWB\d$WHITEB)$BORDCOL$HBAR$HBAR$HBAR$WHITEB($RCOL\t$WHITEB)$BORDCOL$HBAR$HBAR$HBAR$HBAR$BORDCOL\n\[\016\]$PR_LLCORNER\[\017\]$HBAR$WHITEB(\w)$BORDCOL$HBAR$WHITEB($GREEN\\\$$RST$GITPROMPT$WHITEB)$BORDCOL-> \[\e[0m\]" + RIGHT="$EXIT$BORDCOL$HBAR$HBAR$HBAR$WHITEB($YELLOWB\d$WHITEB)$BORDCOL$HBAR$HBAR$HBAR$WHITEB($RCOL\t$WHITEB)$BORDCOL$HBAR$HBAR$HBAR$HBAR\n$BORDCOL\[\016\]$PR_LLCORNER\[\017\]$BORDCOL$HBAR$WHITEB(\w)$BORDCOL$HBAR$WHITEB($GREEN\\\$$RST$GITPROMPT$WHITEB)$BORDCOL-> \[\e[0m\]" L_LEN="$USER$HOSTNAM$CH\j" R_LEN="XXX XXX XX, XX:XX:XX$RETURN_CODE" @@ -113,4 +113,4 @@ function __prompt_command() { PS1="$LEFT$FILL$RIGHT" -} \ No newline at end of file +} diff --git a/.bshell/git-prompt.sh b/prompt/git-prompt.sh similarity index 100% rename from .bshell/git-prompt.sh rename to prompt/git-prompt.sh diff --git a/removebb.sh b/removebb.sh new file mode 100644 index 0000000..42fa0ab --- /dev/null +++ b/removebb.sh @@ -0,0 +1,5 @@ +#!/bin/bash +sed -i '/BetterBash/,+1d' ~./bashrc && \ +sed -i '/BetterBash/,+4d' ~./inputrc && \ +rm -r ~/.bb +