1
0
mirror of https://github.com/kremalicious/dotfiles.git synced 2024-11-24 02:52:06 +01:00

shellcheck linting

This commit is contained in:
Matthias Kretschmann 2017-06-12 01:04:18 +02:00
parent ad12115f16
commit 4203456c2a
Signed by: m
GPG Key ID: 606EEEF3C479A91F
10 changed files with 44 additions and 40 deletions

View File

@ -22,7 +22,7 @@ declare -a dirs_to_append=(
# Prepend directories to PATH
for index in ${!dirs_to_prepend[*]}
do
if [ -d ${dirs_to_prepend[$index]} ]; then
if [ -d "${dirs_to_prepend[$index]}" ]; then
# If these directories exist, then prepend them to existing PATH
PATH="${dirs_to_prepend[$index]}:$PATH"
fi
@ -31,7 +31,7 @@ done
# Append directories to PATH
for index in ${!dirs_to_append[*]}
do
if [ -d ${dirs_to_append[$index]} ]; then
if [ -d "${dirs_to_append[$index]}" ]; then
# If these bins exist, then append them to existing PATH
PATH="$PATH:${dirs_to_append[$index]}"
fi

View File

@ -14,7 +14,7 @@
# Load ~/.private, ~/.bash_prompt
# ----------------------------------------------------------------------
for file in ~/.{bash_paths,bash_prompt,exports,aliases,inputrc,private}; do
for file in ~/.{exports,private,bash_paths,bash_prompt,aliases,inputrc}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file"
done;
unset file;

View File

@ -17,7 +17,7 @@ prompt_git() {
local branchName='';
# Check if the current directory is in a Git repository.
if [ $(git rev-parse --is-inside-work-tree &>/dev/null; echo "${?}") == '0' ]; then
if [ "$(git rev-parse --is-inside-work-tree &>/dev/null; echo "${?}")" == '0' ]; then
# check if the current directory is in .git before running git checks
if [ "$(git rev-parse --is-inside-git-dir 2> /dev/null)" == 'false' ]; then

View File

@ -5,10 +5,10 @@ echo
echo -e "$(tput bold) reg bld und tput-command-colors$(tput sgr0)"
for i in $(seq 1 256); do
echo " $(tput setaf $i)Text$(tput sgr0) $(tput bold)$(tput setaf $i)Text$(tput sgr0) $(tput sgr 0 1)$(tput setaf $i)Text$(tput sgr0) \$(tput setaf $i)"
echo " $(tput setaf "$i")Text$(tput sgr0) $(tput bold)$(tput setaf "$i")Text$(tput sgr0) $(tput sgr 0 1)$(tput setaf "$i")Text$(tput sgr0) \$(tput setaf $i)"
done
echo ' Bold $(tput bold)'
echo ' Underline $(tput sgr 0 1)'
echo ' Reset $(tput sgr0)'
echo " Bold $(tput bold)"
echo " Underline $(tput sgr 0 1)"
echo " Reset $(tput sgr0)"
echo

View File

@ -1,7 +1,7 @@
#!/bin/bash
# give me /usr/local first
sudo chown -R $USER /usr/local
sudo chown -R "$USER" /usr/local
# Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@ -18,7 +18,7 @@ brew install bash
brew install bash-completion2
# Switch to using brew-installed bash as default shell
if ! fgrep -q '/usr/local/bin/bash' /etc/shells; then
if ! grep -F -q '/usr/local/bin/bash' /etc/shells; then
echo '/usr/local/bin/bash' | sudo tee -a /etc/shells;
chsh -s /usr/local/bin/bash;
fi;

View File

@ -31,7 +31,7 @@ touch private
# ----------------------------------------------------------------------
for file in $files; do
ln -s $file ~/.$file
ln -s "$file" ~/."$file"
echo "$(tput setaf 64)$(tput sgr0) Created symlink to $(tput setaf 37)$file$(tput sgr0)"
done
@ -45,52 +45,52 @@ source ~/.bash_profile
# Homebrew
# ----------------------------------------------------------------------
echo "$(tput setaf 136)"
"$(tput setaf 136)"
echo " Brewing all the things. "
echo "============================================="
echo "$(tput sgr0)" # reset
"$(tput sgr0)" # reset
bin/install-brew.sh
echo "$(tput setaf 64)" # green
"$(tput setaf 64)" # green
echo "---------------------------------------------"
echo " ✓ done"
echo "$(tput sgr0)" # reset
"$(tput sgr0)" # reset
# ----------------------------------------------------------------------
# npm
# ----------------------------------------------------------------------
echo "$(tput setaf 136)"
"$(tput setaf 136)"
echo " npm all the things. "
echo "============================================="
echo "$(tput sgr0)" # reset
"$(tput sgr0)" # reset
bin/install-npm.sh
echo "$(tput setaf 64)" # green
"$(tput setaf 64)" # green
echo "---------------------------------------------"
echo " ✓ done"
echo "$(tput sgr0)" # reset
"$(tput sgr0)" # reset
# ----------------------------------------------------------------------
# Ruby
# ----------------------------------------------------------------------
echo "$(tput setaf 136)"
"$(tput setaf 136)"
echo " Ruby all the things. "
echo "============================================="
echo "$(tput sgr0)" # reset
"$(tput sgr0)" # reset
bin/install-ruby.sh
echo "$(tput setaf 64)" # green
"$(tput setaf 64)" # green
echo "---------------------------------------------"
echo " ✓ done"
echo "$(tput sgr0)" # reset
"$(tput sgr0)" # reset
echo "$(tput setaf 64)" # green
"$(tput setaf 64)" # green
echo "============================================="
echo " ✓ all done"
echo "============================================="
echo "$(tput sgr0)" # reset
"$(tput sgr0)" # reset

View File

@ -23,7 +23,7 @@ files="aliases bashrc bash_profile bash_paths bash_prompt editorconfig exports g
# ----------------------------------------------------------------------
for file in $files; do
rm ~/.$file
rm ~/."$file"
done
@ -33,7 +33,7 @@ done
# ----------------------------------------------------------------------
for file in $files; do
ln -s $file ~/.$file
ln -s "$file" ~/."$file"
echo "$(tput setaf 64)$(tput sgr0) Created symlink to $(tput setaf 37)$file$(tput sgr0)"
done

View File

@ -5,10 +5,10 @@
# macOS
# -------------
echo "$(tput setaf 136)"
"$(tput setaf 136)"
echo "Update macOS Apps "
echo "------------------------------"
echo "$(tput sgr0)" # reset
"$(tput sgr0)" # reset
#sudo softwareupdate -i -a
@ -18,10 +18,10 @@ mas upgrade
# Homebrew
# -------------
echo "$(tput setaf 136)"
"$(tput setaf 136)"
echo "Update Homebrew "
echo "------------------------------"
echo "$(tput sgr0)" # reset
"$(tput sgr0)" # reset
brew update
brew upgrade
@ -32,10 +32,10 @@ brew cleanup
# npm
# -------------
echo "$(tput setaf 136)"
"$(tput setaf 136)"
echo "Update npm "
echo "------------------------------"
echo "$(tput sgr0)" # reset
"$(tput sgr0)" # reset
# update npm itself
npm install npm -g
@ -47,10 +47,10 @@ npm update -g
# Ruby
# -------------
echo "$(tput setaf 136)"
"$(tput setaf 136)"
echo "Update rvm "
echo "------------------------------"
echo "$(tput sgr0)" # reset
"$(tput sgr0)" # reset
# update rvm itself
rvm get stable
@ -66,14 +66,14 @@ rvm cleanup all
# GPG
# -------------
echo "$(tput setaf 136)"
"$(tput setaf 136)"
echo "Refresh GPG keys "
echo "------------------------------"
echo "$(tput sgr0)" # reset
"$(tput sgr0)" # reset
gpg --refresh-keys
echo "$(tput setaf 64)" # green
"$(tput setaf 64)" # green
echo "-------------------------------"
echo " ✓ all done"
echo "$(tput sgr0)" # reset
"$(tput sgr0)" # reset

View File

@ -13,7 +13,7 @@
updateRepo() {
local dir="$1"
local original_dir="$2"
cd $dir # switch to the git repo
cd "$dir" # switch to the git repo
repo_url=$(git config --get remote.origin.url)
echo "$(tput setaf 136)Updating Repo: $dir with url: $repo_url$(tput sgr0)"

View File

@ -15,3 +15,7 @@ export LSCOLORS=gxfxcxdxbxegedabagacad
export PIP_REQUIRE_VIRTUALENV=true
# cache pip-installed packages to avoid re-downloading
export PIP_DOWNLOAD_CACHE=$HOME/.pip/cache
# go
export GOPATH=$HOME/.go
export GOROOT=/usr/local/opt/go/libexec