alias/general: `shellcheck`

pull/2047/head
John D Pell 2022-01-16 12:56:16 -08:00
parent 5748aa20a7
commit 11aa32387e
1 changed files with 13 additions and 14 deletions

View File

@ -1,10 +1,9 @@
cite about-alias # shellcheck shell=bash
about-alias 'general aliases' about-alias 'general aliases'
if ls --color -d . &> /dev/null; then if command ls --color -d . &> /dev/null; then
alias ls="ls --color=auto" alias ls="ls --color=auto"
elif ls -G -d . &> /dev/null; then # BSD `ls` doesn't need an argument (`-G`) when `$CLICOLOR` is set.
alias ls='ls -G' # Compact view, show colors
fi fi
# List directory contents # List directory contents
@ -18,13 +17,13 @@ alias lf='ls -F'
alias _="sudo" alias _="sudo"
# Shortcuts to edit startup files # Shortcuts to edit startup files
alias vbrc="vim ~/.bashrc" alias vbrc="${VISUAL:-vim} ~/.bashrc"
alias vbpf="vim ~/.bash_profile" alias vbpf="${VISUAL:-vim} ~/.bash_profile"
# colored grep # colored grep
# Need to check an existing file for a pattern that will be found to ensure # Need to check an existing file for a pattern that will be found to ensure
# that the check works when on an OS that supports the color option # that the check works when on an OS that supports the color option
if grep --color=auto "a" "${BASH_IT}/"*.md &> /dev/null; then if command grep --color=auto "a" "${BASH_IT?}"/*.md &> /dev/null; then
alias grep='grep --color=auto' alias grep='grep --color=auto'
fi fi
@ -36,12 +35,12 @@ alias c='clear'
alias k='clear' alias k='clear'
alias cls='clear' alias cls='clear'
alias edit="$EDITOR" alias edit='${EDITOR:-${ALTERNATE_EDITOR?}}'
alias pager="$PAGER" alias pager='${PAGER:=less}'
alias q='exit' alias q='exit'
alias irc="${IRC_CLIENT:=irc}" alias irc='${IRC_CLIENT:=irc}'
# Language aliases # Language aliases
alias rb='ruby' alias rb='ruby'
@ -74,13 +73,13 @@ alias rd='rmdir'
alias xt="extract" alias xt="extract"
# sudo editors # sudo editors
alias svim="sudo vim" alias svim="sudo ${VISUAL:-vim}"
alias snano="sudo nano" alias snano="sudo nano"
# Display whatever file is regular file or folder # Display whatever file is regular file or folder
catt() { function catt() {
for i in "$@"; do for i in "$@"; do
if [ -d "$i" ]; then if [[ -d "$i" ]]; then
ls "$i" ls "$i"
else else
cat "$i" cat "$i"
@ -94,5 +93,5 @@ catt() {
# aliases and enable just the ones for Bash-it explicitly: # aliases and enable just the ones for Bash-it explicitly:
# bash-it disable alias general # bash-it disable alias general
# bash-it enable alias bash-it # bash-it enable alias bash-it
# shellcheck source=./bash-it.aliases.bash # shellcheck source-path=SCRIPTDIR
source "$BASH_IT/aliases/available/bash-it.aliases.bash" source "$BASH_IT/aliases/available/bash-it.aliases.bash"