name change
This commit is contained in:
Executable → Regular
+138
-167
@@ -1,51 +1,29 @@
|
||||
# ==============================================================================
|
||||
# Auth: Alex Celani
|
||||
# File: .bash_profile
|
||||
# Revn: 03-06-2022 2.3
|
||||
# Auth:dodd
|
||||
# File: .bashrc
|
||||
# Revn: 01-04-2025 1.0
|
||||
# Func: Define user-made aliases and functions to make using the terminal easier
|
||||
#
|
||||
# TODO: fix alias to cd
|
||||
# TODO: break down PS1 stuff
|
||||
# color files in ls, and color different file differently
|
||||
# pick a new color and prompt scheme
|
||||
# rename mkcd()
|
||||
# ==============================================================================
|
||||
# CHANGE LOG
|
||||
# ------------------------------------------------------------------------------
|
||||
# ??-??-2018: init
|
||||
# 05-31-2019: added header comment block
|
||||
# 06-01-2019: fixed newcd, added alias of cc to newcd
|
||||
# commented functions
|
||||
# removed mkcd
|
||||
# made hide, ssy, and SSY aliases instead of functions
|
||||
# 06-21-2019: finally wrote Func field in header
|
||||
# 03-25-2020: copied from .bashrc
|
||||
# removed school-based functions to go to directories that do not
|
||||
# exist on boofnet
|
||||
# 05-11-2020: added control structure to detect architecure and make decisions
|
||||
# about directories for grad() and src()
|
||||
# 09-29-2020: wrote gitMake()
|
||||
# renamed newcd() to mkcd()
|
||||
# 10-07-2020: fixed src() and grad() not working on colossus by changing call
|
||||
# to arch from "arch" to "$(arch)"
|
||||
# added call to src() at the beginning of the file
|
||||
# 10-12-2020: added -F to ll and l aliases
|
||||
# 10-21-2020: added alias to spotify to make it work globally to
|
||||
# avoid setting PATH
|
||||
# added alias for neofetch
|
||||
# finally made PS1 work with PROMPT_COMMAND
|
||||
# made short function for showing short now playing
|
||||
# 10-24-2020: deleted .bashrc; call to static .bashrc on colossus
|
||||
# will change source to .bash_profile
|
||||
# changed alias for spotify to sp
|
||||
# added parse_git_branch() to get branch name for PS1
|
||||
# changed grad() to work without probing the architecture
|
||||
# removed colors from PS1, got obnoxious
|
||||
# added mkcd() again
|
||||
# 01-18-2021: added alias for 'remake'
|
||||
# 03-06-2022: added alias for donut, and wordle executables
|
||||
# 07-12-2023: init
|
||||
# cleaned it up a little
|
||||
# 08-24-2023: updated some PS1 stuff, added documentation
|
||||
# 08-30-2023: added link to color resource
|
||||
# 05-16-2024: updated exe name for ekho, changed call
|
||||
# 06-07-2024: added "if not running interactively" line to make scp
|
||||
# work
|
||||
# 06-09-2024: updated ekho exe to ekho-cli-sen
|
||||
#*01-04-2025: added vim -p alias
|
||||
#
|
||||
# ==============================================================================
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
[[ $- == *i* ]] || return
|
||||
|
||||
# User specific aliases and functions
|
||||
## Aliases
|
||||
@@ -53,34 +31,22 @@
|
||||
### Shows everything in detail, except . and ..
|
||||
alias ll="ls -AFGhl"
|
||||
alias l="ls -AFGhl"
|
||||
|
||||
### Used for login
|
||||
alias s="ssh sacelani@colossus.it.mtu.edu"
|
||||
|
||||
### Move to desktop fast
|
||||
alias desk="cd ~/Desktop"
|
||||
|
||||
### Move to desktop fast, verbose
|
||||
alias DESK="CD ~/Desktop"
|
||||
alias lr="ls -AFGhlR"
|
||||
|
||||
### Go home
|
||||
alias home="cd ~"
|
||||
|
||||
### Go home, verbose
|
||||
alias HOME="CD ~"
|
||||
### TDM stuff
|
||||
alias todo="~/bin/todo"
|
||||
alias mark="~/bin/todo mark"
|
||||
alias delete="~/bin/todo delete"
|
||||
alias show="~/bin/todo show"
|
||||
|
||||
### Control Spotify with command line
|
||||
alias sp="~/spotify"
|
||||
### MOTD stuff
|
||||
alias ekho="~/bin/ekho-cli-sen"
|
||||
|
||||
### neofetch
|
||||
alias neofetch="~/neofetch"
|
||||
|
||||
### donut
|
||||
alias donut="~/donut"
|
||||
|
||||
### wordle
|
||||
alias wordle="~/wordle"
|
||||
alias worlde="~/wordle"
|
||||
### vim default to tabs
|
||||
alias vim="vim -p"
|
||||
|
||||
## Aliases
|
||||
|
||||
@@ -99,114 +65,119 @@ alias worlde="~/wordle"
|
||||
# \e[m is no color
|
||||
#export PROMPT_COMMAND="export PS1='\[\e[0;32m\]\W\[\e[1;31m\] -> \[\e[0;32m\]'"
|
||||
#export PROMPT_COMMAND="export PS1='\e[0;31m$(parse_git_branch) \e[m\W -> '"
|
||||
export PROMPT_COMMAND="export PS1='\W -> '"
|
||||
#export PROMPT_COMMAND="export PS1='\W -> '"
|
||||
#export LSCOLORS=exfxcxdxbxegabagacad
|
||||
|
||||
## Functions
|
||||
|
||||
### LaTeX make function
|
||||
tecc() {
|
||||
pdflatex $1 >> /dev/null # compile tex file, output dies
|
||||
rm $1.log # get rid of trash files
|
||||
rm $1.aux
|
||||
}
|
||||
|
||||
### Print name of git branch
|
||||
parse_git_branch() {
|
||||
# call git branch to return list of all branches
|
||||
# redirect output from 2 (error) to null
|
||||
# pipe standard output to grep, get line with *
|
||||
# pipe THAT to function that removes the leading space and *
|
||||
git branch 2>/dev/null | grep '^*' | colrm 1 2
|
||||
}
|
||||
|
||||
### Print Now Playing, short
|
||||
playing() {
|
||||
echo -n $(~/spotify status artist) # Print the artist, no newline
|
||||
echo -n " - " # Print delimiter
|
||||
echo $(~/spotify status track) # Print track, with newline
|
||||
}
|
||||
|
||||
### Change branch name on Github to daddy
|
||||
daddy() {
|
||||
if [ "$#" -eq 1 ]; then
|
||||
git branch -m master $1
|
||||
git push -u origin $1
|
||||
else
|
||||
git branch -m master daddy
|
||||
git push -u origin daddy
|
||||
fi
|
||||
|
||||
echo "Log in to GitHub and change the default branch"
|
||||
echo "Then call 'daddy2'"
|
||||
|
||||
}
|
||||
|
||||
daddy2() {
|
||||
git push origin --delete master
|
||||
git remote set-head origin -a
|
||||
}
|
||||
|
||||
### Detect architecture and load correct source file
|
||||
src() {
|
||||
if [ arch == "x86_64" ]; then # Check to see if using colossus
|
||||
source ~/.bashrc # Reload colossus bash profile
|
||||
else # If not colossus, boofnet
|
||||
source ~/.bash_profile # Reload boofnet bash profile
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
### Change directory and show contents
|
||||
CD() {
|
||||
cd $1 # Move
|
||||
clear # Clear screen
|
||||
ll # Print directory
|
||||
}
|
||||
|
||||
### If cd fails, make the new directory and cd in
|
||||
mkcd() {
|
||||
oldD=$(pwd) # Snag the current directory
|
||||
cd $1 >/dev/null 2>/dev/null # cd, direct error output to null
|
||||
newD=$(pwd) # Snag current directory again
|
||||
|
||||
if [ $oldD == $newD ]; then # If new is same as old, didn't move
|
||||
mkdir $1 # Make the new directory
|
||||
cd $1 # cd in
|
||||
fi
|
||||
}
|
||||
|
||||
### Jump to grad school directory, user specified semester if possible
|
||||
grad() {
|
||||
old=$(pwd);
|
||||
cd ~/Desktop/grad 2>/dev/null
|
||||
if [ $old == $(pwd) ]; then
|
||||
cd ~/Documents/everything 2>/dev/null
|
||||
fi
|
||||
# if [ arch == "x86_64" ]; then # Check to see using colossus
|
||||
# cd ~/Desktop/grad/ # Jump to grad directory, colossus
|
||||
# else # If not colossus, boofnet
|
||||
# cd ~/Documents/everything # Jump to grad directory, boofnet
|
||||
# fi
|
||||
|
||||
if [ "$#" -eq 1 ]; then # See if user entered a semester argument
|
||||
cd "semester-$1" 2>/dev/null # Go to semester, error silently
|
||||
fi
|
||||
}
|
||||
|
||||
### Take new repository and connect it to a Github repository
|
||||
gitMake() {
|
||||
if [ "$#" -eq 1 ]; then
|
||||
# These three lines were given by github.com
|
||||
git remote add origin https://github.com/sacelani/$1.git
|
||||
git branch -M master
|
||||
git push -u origin master
|
||||
else # If the user doesn't give a name for the repo
|
||||
echo -e "Usage:: gitMake REPO" # Print usage
|
||||
echo -e "\tConnect local repo REPO to Github repo"
|
||||
fi
|
||||
}
|
||||
|
||||
## Functions
|
||||
export PATH=$PATH:/usr/local/go/bin
|
||||
|
||||
. "$HOME/.cargo/env"
|
||||
|
||||
|
||||
|
||||
# set variable identifying the chroot you work in (used in the prompt below)
|
||||
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
||||
debian_chroot=$(cat /etc/debian_chroot)
|
||||
fi
|
||||
|
||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||
case "$TERM" in
|
||||
xterm-color) color_prompt=yes;;
|
||||
esac
|
||||
|
||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||
# off by default to not distract the user: the focus in a terminal window
|
||||
# should be on the output of commands, not on the prompt
|
||||
force_color_prompt=yes
|
||||
|
||||
if [ -n "$force_color_prompt" ]; then
|
||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=yes
|
||||
else
|
||||
color_prompt=
|
||||
fi
|
||||
fi
|
||||
|
||||
#TODO come back and break each of these down
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
# PS1 documentation
|
||||
# https://misc.flogisoft.com/bash/tip_colors_and_formatting
|
||||
|
||||
# color resource - https://misc.flogisoft.com/bash/tip_colors_and_formatting
|
||||
e="\e" # escape character
|
||||
# background types
|
||||
rst="[0m"
|
||||
bold="[1m"
|
||||
ul="[4m"
|
||||
blink="[5m"
|
||||
# colors
|
||||
red="[31m"
|
||||
green="[32m"
|
||||
yellow="[33m"
|
||||
blue="[34m"
|
||||
magenta="[35m"
|
||||
cyan="[36m"
|
||||
lred="[91m"
|
||||
lgreen="[92m"
|
||||
lblue="[94m"
|
||||
lmag="[95m"
|
||||
lcyan="[96m"
|
||||
white="[97m"
|
||||
# background colors
|
||||
bred="[40m"
|
||||
bgreen="[42m"
|
||||
bblue="[44m"
|
||||
|
||||
# use different PS1 for each user, while maintaining one bashfile
|
||||
if [ "${USER}" = "venom" ]; then
|
||||
# venom gets diamond dogs
|
||||
#PS1='\[\033[01;34m\]DIAMOND DOGS\[\033[00m\]:\[\033[01;32m\]\W\[\033[00m\] ♢ '
|
||||
PS1="$e$blue""DIAMOND"" "DOGS"$e$rst":"$e$green""\W""$e$rst ♢ "
|
||||
# kaz might get it too
|
||||
elif [ "${USER}" = "ocelot" ]; then
|
||||
# pi/ocelot gets OUTER-HEAVEN
|
||||
# this makes some sense for ocelot, but itd make more sense
|
||||
# for venom or kaz. But still
|
||||
# or something
|
||||
#PS1='\[\033[01;32m\]\h\[\033[00m\]/\[\033[01;37m\]\[\033[07;37m\]XOF\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\] ⇌ '
|
||||
PS1="$e$bold$e$green""\h""$e$rst"::"$e$blue""\W""$e$rst ⇌ "
|
||||
else
|
||||
# use the standard prompt if we don't know the user
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
fi
|
||||
else
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
fi
|
||||
unset color_prompt force_color_prompt
|
||||
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\h: \w\a\]$PS1"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# colored GCC warnings and errors
|
||||
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
# run quick and dirty program to flash an LED
|
||||
~/bin/boot
|
||||
|
||||
# call motd
|
||||
#~/bin/ekho-cli-sen
|
||||
~/bin/client.o
|
||||
|
||||
Reference in New Issue
Block a user