Change bye to be a function. Add spaces to the end of some aliases. Fix indentation to consistently be tabs.
This commit is contained in:
64
bashrc.sh
64
bashrc.sh
@@ -21,11 +21,11 @@ alias shell-reload="reload-bash"
|
|||||||
alias reload-shell="reload-bash"
|
alias reload-shell="reload-bash"
|
||||||
alias reload="reload-bash"
|
alias reload="reload-bash"
|
||||||
|
|
||||||
alias l='ls'
|
alias l='ls '
|
||||||
alias ll='ls -alh'
|
alias ll='ls -alh '
|
||||||
alias lh='ls -ash'
|
alias lh='ls -ash '
|
||||||
|
|
||||||
alias clone="rsync -auPhz --delete --exclude '.gradle' --exclude 'app/build'"
|
alias clone="rsync -auPhz --delete --exclude '.gradle' --exclude 'app/build' "
|
||||||
|
|
||||||
# Easily get to storage devices.
|
# Easily get to storage devices.
|
||||||
curr="`pwd`"
|
curr="`pwd`"
|
||||||
@@ -60,16 +60,16 @@ alias clean-trashed='find "$SS" -name ".trashed*" -exec du -h {} \; -delete | so
|
|||||||
alias check-trashed='find "$SS" -name ".trashed*" -exec du -h {} \; -exec mv -v {} ~/TRASH/ \; | sort -h'
|
alias check-trashed='find "$SS" -name ".trashed*" -exec du -h {} \; -exec mv -v {} ~/TRASH/ \; | sort -h'
|
||||||
|
|
||||||
# Help prevent mistakes.
|
# Help prevent mistakes.
|
||||||
alias cp="cp -v"
|
alias cp="cp -v "
|
||||||
alias mv="mv -v"
|
alias mv="mv -v "
|
||||||
alias rm="echo 'Move to ~/storage/shared/TRASH/ instead!'"
|
alias rm="echo 'Move to ~/storage/shared/TRASH/ instead!'"
|
||||||
|
|
||||||
# Quickies
|
# Quickies
|
||||||
alias bye="exit"
|
function bye { exit; }
|
||||||
alias install="pkg install"
|
alias install="pkg install "
|
||||||
alias uninstall="pkg uninstall"
|
alias uninstall="pkg uninstall "
|
||||||
alias remove="uninstall"
|
alias remove="uninstall "
|
||||||
alias scan="nmap -A -p- --script=vuln"
|
alias scan="nmap -A -p- --script=vuln "
|
||||||
|
|
||||||
|
|
||||||
### Functions ###
|
### Functions ###
|
||||||
@@ -140,15 +140,15 @@ alias termux-reload="reload-termux"
|
|||||||
# Pulled from /me/env-ansible, need to make a shared library between it and Termux.
|
# Pulled from /me/env-ansible, need to make a shared library between it and Termux.
|
||||||
# Change a branch to point at another.
|
# Change a branch to point at another.
|
||||||
function load-branch {
|
function load-branch {
|
||||||
rcvr="$1" # branch which we want to modify
|
rcvr="$1" # branch which we want to modify
|
||||||
base="$2" # branch with the changes we want
|
base="$2" # branch with the changes we want
|
||||||
|
|
||||||
if [[ "$rcvr" == "main" ]]; then
|
if [[ "$rcvr" == "main" ]]; then
|
||||||
echo "*** ERROR: Are you nuts, fool!? Not main! Do it manually! ***"
|
echo "*** ERROR: Are you nuts, fool!? Not main! Do it manually! ***"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$base" ]]; then
|
if [[ -z "$base" ]]; then
|
||||||
if [[ "$rcvr" == "prod" ]]; then
|
if [[ "$rcvr" == "prod" ]]; then
|
||||||
base="stage"
|
base="stage"
|
||||||
elif [[ "$rcvr" == "stage" ]]; then
|
elif [[ "$rcvr" == "stage" ]]; then
|
||||||
@@ -158,22 +158,22 @@ function load-branch {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo "* Base was not specified, using '$base' for '$rcvr'."
|
echo "* Base was not specified, using '$base' for '$rcvr'."
|
||||||
else
|
else
|
||||||
echo "* Requested pointing '$rcvr' branch to '$base'."
|
echo "* Requested pointing '$rcvr' branch to '$base'."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\n* Ensuring we are on base branch '$base'." &&
|
echo -e "\n* Ensuring we are on base branch '$base'." &&
|
||||||
git switch "$base" &&
|
git switch "$base" &&
|
||||||
echo -e "\n* Changing pointer for '$rcvr' to '$base'." &&
|
echo -e "\n* Changing pointer for '$rcvr' to '$base'." &&
|
||||||
git branch -f "$rcvr" "$base" &&
|
git branch -f "$rcvr" "$base" &&
|
||||||
#echo -e "\n* Switching to branch '$rcvr'." &&
|
#echo -e "\n* Switching to branch '$rcvr'." &&
|
||||||
#git switch "$rcvr" &&
|
#git switch "$rcvr" &&
|
||||||
echo -e "\n* Forcing push on branch '$rcvr'." &&
|
echo -e "\n* Forcing push on branch '$rcvr'." &&
|
||||||
git push --force --set-upstream origin "$rcvr" &&
|
git push --force --set-upstream origin "$rcvr" &&
|
||||||
echo -e "\n* Done! Displaying list of remote branches." &&
|
echo -e "\n* Done! Displaying list of remote branches." &&
|
||||||
git ls-remote --heads | sort
|
git ls-remote --heads | sort
|
||||||
|
|
||||||
if [[ "$base" != "dev" ]]; then
|
if [[ "$base" != "dev" ]]; then
|
||||||
echo -e "\n* Checking if a dev branch exists."
|
echo -e "\n* Checking if a dev branch exists."
|
||||||
git ls-remote --exit-code --heads origin dev
|
git ls-remote --exit-code --heads origin dev
|
||||||
dev_exists="$?"
|
dev_exists="$?"
|
||||||
@@ -186,10 +186,10 @@ function load-branch {
|
|||||||
else
|
else
|
||||||
echo "*** ERROR: Unknown status for dev_exists, '$dev_exists'. ***"
|
echo "*** ERROR: Unknown status for dev_exists, '$dev_exists'. ***"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\n* Verifying which branch we're on."
|
echo -e "\n* Verifying which branch we're on."
|
||||||
git branch
|
git branch
|
||||||
}
|
}
|
||||||
alias load-prod="load-branch prod"
|
alias load-prod="load-branch prod"
|
||||||
alias load-stage="load-branch stage"
|
alias load-stage="load-branch stage"
|
||||||
|
|||||||
Reference in New Issue
Block a user