shell code cleanup using shellcheck

This commit is contained in:
lhark 2016-10-22 01:10:25 -04:00
parent 0e14d4b93c
commit 12691112e5
2 changed files with 18 additions and 20 deletions

View file

@ -1,24 +1,22 @@
#!/bin/bash
#!/bin/sh
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
HOST=`hostname`
HOST=$(hostname)
# List of the config files to install
FILES="vimrc zshrc gitconfig vim gitignore_global git_user"
if [[ ! -e $HOME/.git_user ]]
then
cp $SCRIPTPATH/git_user.def $SCRIPTPATH/git_user
sed -i -e "s/{username}/$USER/" $SCRIPTPATH/git_user
sed -i -e "s/{email}/$USER@$HOST/" $SCRIPTPATH/git_user
if [ ! -e "$HOME/.git_user" ]; then
cp "$SCRIPTPATH/git_user.def" "$SCRIPTPATH/git_user"
sed -i -e "s/{username}/$USER/" "$SCRIPTPATH/git_user"
sed -i -e "s/{email}/$USER@$HOST/" "$SCRIPTPATH/git_user"
fi
# Create symbolic links in the user's home dir
for file in $FILES
do
if [ ! -e $HOME/.${file} ]
then
ln -s ${SCRIPTPATH}/${file} $HOME/.${file}
if [ ! -e "$HOME/.${file}" ]; then
ln -s "${SCRIPTPATH}/${file}" "$HOME/.${file}"
fi
done

20
zshrc
View file

@ -18,7 +18,7 @@ RC_PATH=$(dirname "$(readlink -f ${(%):-%x})")
# Import utility functions
. $RC_PATH/functions
. "$RC_PATH/functions"
# Check for rc updates
@ -50,7 +50,7 @@ alias steam="LD_PRELOAD='/usr/\$LIB/libstdc++.so.6 /usr/\$LIB/libgcc_s.so.1 /usr
# Configuration pour minecraft
alias minecraft="java -jar $HOME/.minecraft/launcher.jar"
alias minecraft='java -jar $HOME/.minecraft/launcher.jar'
# Easy dwm recompile on arch
@ -273,13 +273,13 @@ setopt correct
# Syntax coloration for man
man() {
env \
LESS_TERMCAP_mb=$(printf "$fg_bold[red]") \
LESS_TERMCAP_md=$(printf "$fg_bold[red]") \
LESS_TERMCAP_me=$(printf "$reset_color") \
LESS_TERMCAP_se=$(printf "$reset_color") \
LESS_TERMCAP_so=$(printf "$bg[black]$fg[yellow]") \
LESS_TERMCAP_ue=$(printf "$reset_color") \
LESS_TERMCAP_us=$(printf "$fg_bold[blue]") \
LESS_TERMCAP_mb="$(printf "%s" "$fg_bold[red]")" \
LESS_TERMCAP_md="$(printf "%s" "$fg_bold[red]")" \
LESS_TERMCAP_me="$(printf "%s" "$reset_color")" \
LESS_TERMCAP_se="$(printf "%s" "$reset_color")" \
LESS_TERMCAP_so="$(printf "%s" "$bg[black]$fg[yellow]")" \
LESS_TERMCAP_ue="$(printf "%s" "$reset_color")" \
LESS_TERMCAP_us="$(printf "%s" "$fg_bold[blue]")" \
man "$@"
}
# source ~/.zs/zsh-syntax-highlighting.zsh
@ -293,4 +293,4 @@ man() {
# fi
# ZSH syntax highlighting : /!\ keep at the bottom !
source ${RC_PATH}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source "${RC_PATH}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"