diff --git a/.bash_host b/.bash_host index fe998cb..8ca0fb9 100644 --- a/.bash_host +++ b/.bash_host @@ -32,3 +32,8 @@ HOST_COLOUR="${HC}${FYEL}" # Whether we should disable hh integration or not. # Useful if we're on a machine that doesn't have it installed. NO_HH=false; + +which hh; +if [[ "$?" -ne "0" ]; then + NO_HH=true; +fi diff --git a/README.md b/README.md index 80204b1..c4f28cb 100644 --- a/README.md +++ b/README.md @@ -56,18 +56,30 @@ Here's a list of the most interesting ones, along with what they do and where th - nautilus-here - A quick command that opens nautilus in the current directory. For lazy people :P - ssh-retry - I forget where it came from, but this command reepeatedly calls ssh until it succeeds in connecting. -## `cloudjumper.sh` -`cloudjumper.sh` is a new script I'm writing to bring some of the customisations I store here in this repository to terminals on shared machines - where I can't modify `.bashrc`, for example. +## cloudsurfer.sh +`cloudsurfer.sh` is a new script I'm writing to bring some of the customisations I store here in this repository to terminals on shared machines - where I can't modify `.bashrc`, for example. It's designed to be executed in a single bash context, and leave no trace on the host machine after the customisations are applied - just in case the bash process crashes! If need be, it can also be executed in multiple separate bash processes and will bring the customisations to each one separately - without interfering with the rest of the machine. -Due to it's transient nature, cloudjumper is bound to be more lightweight and be missing a few features of the full list that my main bin folder can provide, but the aim is to make a foreign terminal feel a bit more like home :smiley_cat: +Due to it's transient nature, cloudsurfer is bound to be more lightweight and be missing a few features of the full list that my main bin folder can provide, but the aim is to make a foreign terminal feel a bit more like home :smiley_cat: Here's a list of things it currently supports: - Aliases - by dynamically loading the main `.bash_aliases` + - Colouring the prompt to remind you that cloudsurfer is active - _(Got an idea of something to include? File an issue, or open a pull request!)_ +To use it, simply paste this into the target terminal: + +```bash + cstemp=$(mktemp); curl -o ${cstemp} -L https://goo.gl/ZTtVRq; chmod +x ${cstemp}; source ${cstemp}; rm ${cstemp}; cstemp=; +``` + +and then to drop out of cloudsurfer again: + +```bash +exec bash && reset +``` + ## Disclaimer I don't own many of the tools in this repository. If you are an owner of one of these tools and I haven't linked to you, please let me know as I probably forgot. - diff --git a/cloudjumper/cloudjumper.sh b/cloudjumper/cloudjumper.sh deleted file mode 100644 index 0e9da2e..0000000 --- a/cloudjumper/cloudjumper.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -### Settings ### - -aliases_url="https://raw.githubusercontent.com/sbrl/bin/master/.bash_aliases"; - -################ - -aliases_tmp_file=$(mktemp --suffix ".cloudjumper.sh"); - -curl -o "${aliases_tmp_file}" "${aliases_url}" -chmod u+x "${aliases_tmp_file}" - -source "${aliases_tmp_file}" - - -rm "${aliases_tmp_file}" - diff --git a/cloudsurfer/cloudsurfer.sh b/cloudsurfer/cloudsurfer.sh new file mode 100755 index 0000000..b41ac17 --- /dev/null +++ b/cloudsurfer/cloudsurfer.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +echo -ne "Initialsing cloudsurfer: "; + +### Settings ### + +aliases_url="https://raw.githubusercontent.com/sbrl/bin/master/.bash_aliases"; + +################ +echo -ne "s"; + + +### Aliases file ### + +aliases_tmp_file=$(mktemp --suffix ".cloudjumper.sh"); + +curl -o "${aliases_tmp_file}" "${aliases_url}" 2>/dev/null; +ec_alias_download="$?"; +if [[ "${ec_alias_download}" -ne "0" ]]; then + echo "E"; + echo "Error\! Got exit code ${ec_alias_download} from curl when downloading the bash_aliases file"; + exit ${ec_alias_download}; +fi; +chmod u+x "${aliases_tmp_file}"; + +source "${aliases_tmp_file}"; + +#################### +echo -ne "+a"; + +### Prompt ### + +# Set the prompt to a cyan / blue colour to let everyone know we've enabled cloudjumper successfully +PS1="\[\033[1m\]\[\033[34m\]${PS1}\[\033[0m\]"; + +############## +echo -ne "+p"; + +### Cleanup ### + +rm "${aliases_tmp_file}" >/dev/null; + +############### +echo -ne "+c"; + +echo " - done";