diff --git a/.rultor.yml b/.rultor.yml index bd16c4c27..2a2b445e8 100644 --- a/.rultor.yml +++ b/.rultor.yml @@ -5,4 +5,4 @@ install: - git submodule update - locale - ./build/install.sh - - ./build.sh + - ./build/build.sh diff --git a/.travis.yml b/.travis.yml index ce9ce2a1c..d352435d3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,6 @@ language: bash install: - ./build/install.sh script: - - ./build.sh + - ./build/build.sh notifications: email: false diff --git a/README.md b/README.md index b99559641..ad6b8ec64 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,10 @@ If you're brand-new to the project and run into any blockers, please [open an issue](https://github.com/caarlos0/dotfiles/issues) on this repository and I'd love to get it fixed for you! +## known issues + +- All SC2039 ignores should be fixed (#65); + ## contributing Feel free to contribute. Pull requests will be automatically diff --git a/antigen/install.sh b/antigen/install.sh index a572890ff..6c5544c98 100755 --- a/antigen/install.sh +++ b/antigen/install.sh @@ -1,2 +1,2 @@ -#!/bin/zsh +#!/bin/sh touch ~/.z diff --git a/antigen/path.zsh b/antigen/path.zsh index 143a0921d..cca254e6d 100644 --- a/antigen/path.zsh +++ b/antigen/path.zsh @@ -1,2 +1,2 @@ -#!/bin/zsh +#!/bin/sh source "$ZSH/antigen/antigen/antigen.zsh" diff --git a/atom.symlink/install.sh b/atom.symlink/install.sh index fd4187553..bcf29f02e 100755 --- a/atom.symlink/install.sh +++ b/atom.symlink/install.sh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh [ "$(uname -s)" = "Darwin" ] && brew cask install atom apm install \ editorconfig autocomplete-plus \ diff --git a/bin/dot b/bin/dot index dba7ebf40..e953c2c03 100755 --- a/bin/dot +++ b/bin/dot @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh # # dot # @@ -6,13 +6,14 @@ # to make sure you're on the latest and greatest. main() { cd ~/.dotfiles + # shellcheck disable=SC2155 export ZSH="$(pwd)" echo "Updating dotfiles..." git pull origin master echo "Updating antigen plugins..." git submodule update - source ./antigen/antigen/antigen.zsh + . ./antigen/antigen/antigen.zsh antigen apply antigen update diff --git a/bin/e b/bin/e index 5a4f4edc5..67d54e4d9 100755 --- a/bin/e +++ b/bin/e @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh # # Quick shortcut to an editor. # diff --git a/bin/git-add-rm-line-count b/bin/git-add-rm-line-count index 664ec7fb7..9cbd4ce03 100755 --- a/bin/git-add-rm-line-count +++ b/bin/git-add-rm-line-count @@ -1,9 +1,10 @@ #!/bin/bash set -eo pipefail add_rm_lc() { - local diff_result=$(git diff) - local added=$(echo "$diff_result" | grep -c '^+') - local deleted=$(echo "$diff_result" | grep -c '^-') + local diff_result added deleted + diff_result=$(git diff) + added=$(echo "$diff_result" | grep -c '^+') + deleted=$(echo "$diff_result" | grep -c '^-') echo "${added} additions and ${deleted} deletions." } add_rm_lc "$@" diff --git a/bin/killport b/bin/killport index 63cb40d2f..f9a2f9b30 100755 --- a/bin/killport +++ b/bin/killport @@ -1,2 +1,2 @@ -#!/bin/zsh +#!/bin/sh kill -9 "$(lsof -i tcp:"$1" | head -n 2 | tail -n 1 | awk '{print $2}')" diff --git a/bin/lsopenports b/bin/lsopenports index 99bd2c085..627289084 100755 --- a/bin/lsopenports +++ b/bin/lsopenports @@ -1,2 +1,2 @@ -#!/bin/zsh +#!/bin/sh lsof -i -n -P diff --git a/build b/build index 1df67b25d..c568d592d 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 1df67b25da1a5742c73ba7f9653de34dbe5af2b9 +Subproject commit c568d592d88305fe0638cf28b3965b95fe75510f diff --git a/build.sh b/build.sh deleted file mode 100755 index 305b70f68..000000000 --- a/build.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -set -eo pipefail -source ./build/build.sh -check "./zsh/zshrc.symlink" diff --git a/docker/install.sh b/docker/install.sh index 5e8b39b64..0ab190225 100755 --- a/docker/install.sh +++ b/docker/install.sh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh if [ "$(uname -s)" = "Darwin" ]; then brew cask install kitematic fi diff --git a/docker/path.zsh b/docker/path.zsh index 2347aa30e..808b54215 100755 --- a/docker/path.zsh +++ b/docker/path.zsh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh reload-docker() { eval "$(docker-machine env dev)" } diff --git a/functions/c b/functions/c index ec71d8fcb..1f913f723 100755 --- a/functions/c +++ b/functions/c @@ -1,2 +1,2 @@ -#!/bin/zsh +#!/bin/sh cd "$PROJECTS/$1" diff --git a/functions/d b/functions/d index e03ae0e7c..7faf84b30 100755 --- a/functions/d +++ b/functions/d @@ -1,2 +1,2 @@ -#!/bin/zsh +#!/bin/sh cd "$ZSH/$1" diff --git a/functions/extract b/functions/extract index 72ccc2858..23c298fe2 100755 --- a/functions/extract +++ b/functions/extract @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh # credit: http://nparikh.org/notes/zshrc.txt # Usage: extract # Description: extracts archived files / mounts disk images @@ -25,4 +25,3 @@ extract () { echo "'$1' is not a valid file" fi } - diff --git a/functions/h b/functions/h index 23f752462..7060e5fc7 100755 --- a/functions/h +++ b/functions/h @@ -1,2 +1,2 @@ -#!/bin/zsh +#!/bin/sh cd "$HOME/$1" diff --git a/functions/server b/functions/server index 61550bc13..a817e815c 100755 --- a/functions/server +++ b/functions/server @@ -1,5 +1,5 @@ -#!/bin/zsh -function server { +#!/bin/sh +server() { local port="${1-8000}" python -m SimpleHTTPServer "$port" & open "http://localhost:$port" diff --git a/git/aliases.zsh b/git/aliases.zsh index e391dd176..911d8a0f7 100755 --- a/git/aliases.zsh +++ b/git/aliases.zsh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh alias gl='git pull --prune' alias glg="git log --graph --decorate --oneline --abbrev-commit" alias gp='git push origin HEAD' diff --git a/git/install.sh b/git/install.sh index 6cb9f4d8d..6c1d18541 100755 --- a/git/install.sh +++ b/git/install.sh @@ -1,3 +1,3 @@ -#!/bin/zsh +#!/bin/sh [ "$(uname -s)" != "Darwin" ] && return 0 brew install git diff --git a/golang/install.sh b/golang/install.sh index 88437808a..588a1586a 100755 --- a/golang/install.sh +++ b/golang/install.sh @@ -1,3 +1,3 @@ -#!/bin/zsh +#!/bin/sh [ "$(uname -s)" != "Darwin" ] && return 0 brew install go diff --git a/golang/path.zsh b/golang/path.zsh index c7c798966..27927d338 100755 --- a/golang/path.zsh +++ b/golang/path.zsh @@ -1,3 +1,3 @@ -#!/bin/zsh +#!/bin/sh export GOPATH="$PROJECTS/Go" [ ! -d "$GOPATH" ] && mkdir -p "$GOPATH" diff --git a/homebrew/aliases.zsh b/homebrew/aliases.zsh index f3fb3f84a..0991a2e16 100755 --- a/homebrew/aliases.zsh +++ b/homebrew/aliases.zsh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh brewbump() { brew update brew upgrade --all diff --git a/homebrew/install.sh b/homebrew/install.sh index 1a726725d..f4f2142ed 100755 --- a/homebrew/install.sh +++ b/homebrew/install.sh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh # # Homebrew # diff --git a/java/aliases.zsh b/java/aliases.zsh index 0ace1cd11..9a9f14251 100755 --- a/java/aliases.zsh +++ b/java/aliases.zsh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh mvn() { # shellcheck disable=SC2068 diff --git a/java/install.sh b/java/install.sh index c985814d4..38fb2abfc 100755 --- a/java/install.sh +++ b/java/install.sh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh [ "$(uname -s)" != "Darwin" ] && return 0 # install some java stuff diff --git a/java/path.zsh b/java/path.zsh index 5a1c4ff04..82dd7019c 100755 --- a/java/path.zsh +++ b/java/path.zsh @@ -1,2 +1,2 @@ -#!/bin/zsh +#!/bin/sh export MAVEN_OPTS="-Xmx1024m" diff --git a/node/aliases.zsh b/node/aliases.zsh index 7e69f06c3..3f17880a7 100755 --- a/node/aliases.zsh +++ b/node/aliases.zsh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh alias npis='npm install --save' alias npisd='npm install --save-dev' alias npig='npm install -g' diff --git a/node/install.sh b/node/install.sh index 61de0f75b..a33ffe7bb 100755 --- a/node/install.sh +++ b/node/install.sh @@ -1,3 +1,3 @@ -#!/bin/zsh +#!/bin/sh [ "$(uname -s)" != "Darwin" ] && return 0 brew install node diff --git a/node/path.zsh b/node/path.zsh index 241a213ff..c27fa78e2 100755 --- a/node/path.zsh +++ b/node/path.zsh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh export PATH="/usr/local/share/npm/bin:$PATH" export PATH="$PATH:$HOME/.npm/bin" diff --git a/postgres/path.zsh b/postgres/path.zsh index 11563bce6..c4c722237 100755 --- a/postgres/path.zsh +++ b/postgres/path.zsh @@ -1,4 +1,4 @@ -#!/bin/zsh -if [[ "$(uname -s)" = "Darwin" ]]; then +#!/bin/sh +if [ "$(uname -s)" = "Darwin" ]; then export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin fi diff --git a/ruby/aliases.zsh b/ruby/aliases.zsh index 9b9e36a47..eb368def1 100755 --- a/ruby/aliases.zsh +++ b/ruby/aliases.zsh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh alias migrate='rake db:migrate' alias fs='bundle exec foreman start' alias fsdev='bundle exec foreman start -f Procfile.dev' diff --git a/ruby/install.sh b/ruby/install.sh index ab262ec08..03a124c66 100755 --- a/ruby/install.sh +++ b/ruby/install.sh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh [ "$(uname -s)" != "Darwin" ] && return 0 if test ! "$(which rbenv)"; then diff --git a/ruby/path.zsh b/ruby/path.zsh index db1bb3e94..f646be575 100755 --- a/ruby/path.zsh +++ b/ruby/path.zsh @@ -1,7 +1,8 @@ -#!/bin/zsh +#!/bin/sh if [ -d "$HOME/.rbenv" ]; then export PATH="$HOME/.rbenv/bin:$PATH" fi +# shellcheck disable=SC2039 if rbenv &>/dev/null; then eval "$(rbenv init -)" fi diff --git a/ruby/rbenv.zsh b/ruby/rbenv.zsh index 41045e06f..b7e65736d 100755 --- a/ruby/rbenv.zsh +++ b/ruby/rbenv.zsh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh # rehash shims rbenv rehash 2>/dev/null diff --git a/script/bootstrap b/script/bootstrap index 11cbed2ad..24255f9bd 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -65,7 +65,7 @@ link_file () { if [ "$overwrite_all" == "false" ] && [ "$backup_all" == "false" ] && [ "$skip_all" == "false" ] then - # shellcheck disable=SC2086 + # shellcheck disable=SC2086,SC2155 local currentSrc="$(readlink $dst)" if [ "$currentSrc" == "$src" ] diff --git a/slate/install.sh b/slate/install.sh index 1d4e52da7..b3a86188b 100755 --- a/slate/install.sh +++ b/slate/install.sh @@ -1,3 +1,3 @@ -#!/bin/zsh +#!/bin/sh [ "$(uname -s)" != "Darwin" ] && return 0 brew cask install slate diff --git a/ssh/aliases.zsh b/ssh/aliases.zsh index dcb0bdab9..75c4ff606 100755 --- a/ssh/aliases.zsh +++ b/ssh/aliases.zsh @@ -1,2 +1,2 @@ -#!/bin/zsh +#!/bin/sh alias pubkey="more ~/.ssh/id_rsa.pub | pbcopy | echo '=> Public key copied to pasteboard.'" diff --git a/sublime-text-3/install.sh b/sublime-text-3/install.sh index ff3585490..03420bd4f 100755 --- a/sublime-text-3/install.sh +++ b/sublime-text-3/install.sh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh if [ "$(uname -s)" = "Darwin" ]; then brew cask install sublime-text3 diff --git a/system/aliases.zsh b/system/aliases.zsh index 3f0eef526..3406b70da 100755 --- a/system/aliases.zsh +++ b/system/aliases.zsh @@ -1,7 +1,8 @@ -#!/bin/zsh +#!/bin/sh # grc overides for ls # Made possible through contributions from generous benefactors like # `brew install coreutils` +# shellcheck disable=SC2039 if gls &>/dev/null; then alias ls="gls -F --color" alias l="gls -lAh --color" @@ -17,17 +18,17 @@ alias grep="grep --color=auto" alias duf="du -sh * | sort -hr" alias less="less -r" -if [[ -z $(command -v pbcopy) ]]; then - if [[ -n $(command -v xclip) ]]; then +if [ -z "$(command -v pbcopy)" ]; then + if [ -n "$(command -v xclip)" ]; then alias pbcopy="xclip -selection clipboard" alias pbpaste="xclip -selection clipboard -o" - elif [[ -n $(command -v xsel) ]]; then + elif [ -n "$(command -v xsel)" ]; then alias pbcopy="xsel --clipboard --input" alias pbpaste="xsel --clipboard --output" fi fi -if [[ "$(uname -s)" != "Darwin" ]]; then +if [ "$(uname -s)" != "Darwin" ]; then if [ -e /usr/bin/xdg-open ]; then alias open="xdg-open" fi diff --git a/system/env.zsh b/system/env.zsh index bf273c051..8b6fa71ce 100755 --- a/system/env.zsh +++ b/system/env.zsh @@ -1,2 +1,2 @@ -#!/bin/zsh +#!/bin/sh export EDITOR='atom' diff --git a/system/grc.zsh b/system/grc.zsh index b34959aee..67802285b 100755 --- a/system/grc.zsh +++ b/system/grc.zsh @@ -1,5 +1,6 @@ -#!/bin/zsh +#!/bin/sh # GRC colorizes nifty unix tools all over the place +# shellcheck disable=2039 if grc &>/dev/null && ! brew &>/dev/null; then - source "$(brew --prefix)/etc/grc.bashrc" + . "$(brew --prefix)/etc/grc.bashrc" fi diff --git a/system/path.zsh b/system/path.zsh index cfca2006d..8600de395 100755 --- a/system/path.zsh +++ b/system/path.zsh @@ -1,3 +1,3 @@ -#!/bin/zsh +#!/bin/sh export PATH="./bin:/usr/local/bin:/usr/local/sbin:$ZSH/bin:$PATH" export MANPATH="/usr/local/man:/usr/local/mysql/man:/usr/local/git/man:$MANPATH" diff --git a/terminator/install.sh b/terminator/install.sh index 6e0485a37..b737f388c 100755 --- a/terminator/install.sh +++ b/terminator/install.sh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh [ "$(uname -s)" = "Darwin" ] && return 0 mkdir -p ~/.config/terminator/ ln -sf "$ZSH"/terminator/base16-ocean-dark.config ~/.config/terminator/config diff --git a/vim/install.sh b/vim/install.sh index 38acad64c..648bbaabc 100755 --- a/vim/install.sh +++ b/vim/install.sh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh setup_command_t() { cd "$ZSH"/vim/vimfiles/vim.symlink/bundle/command-t/ruby/command-t ruby extconf.rb diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 90ca134d7..1b3a3a839 100755 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1,7 +1,7 @@ -#!/bin/zsh +#!/bin/sh __reload_dotfiles() { - export PATH="$(command -p getconf PATH)" - source ~/.zshrc + PATH="$(command -p getconf PATH)" + . ~/.zshrc cd . } alias reload!='__reload_dotfiles' diff --git a/zsh/completion.zsh b/zsh/completion.zsh index 7d10a5603..6cb1aceac 100755 --- a/zsh/completion.zsh +++ b/zsh/completion.zsh @@ -1,8 +1,8 @@ #!/bin/zsh # Force rehash when command not found _force_rehash() { - (( CURRENT == 1 )) && rehash - return 1 + (( CURRENT == 1 )) && rehash + return 1 } # forces zsh to realize new commands diff --git a/zsh/window.zsh b/zsh/window.zsh index 07d63d2ed..f5f8140ae 100755 --- a/zsh/window.zsh +++ b/zsh/window.zsh @@ -1,7 +1,7 @@ -#!/bin/zsh +#!/bin/sh # From http://dotfiles.org/~_why/.zshrc # Sets the window title nicely no matter where you are -function title() { +title() { # escape '%' chars in $1, make nonprintables visible a=${(V)1//\%/\%\%}