1
0
Fork 0
mirror of https://github.com/hcartiaux/dotfiles.git synced 2024-10-18 09:15:24 +02:00

[bash] fix warnings reported by shellcheck

This commit is contained in:
Hyacinthe Cartiaux 2015-07-02 12:00:12 +02:00
parent e21dbbdc09
commit 34ee7c392b
3 changed files with 12 additions and 15 deletions

View file

@ -11,11 +11,11 @@ LS_COMMON="-F --group-directories-first -h"
if [ "$UNAME" = Darwin ]; then
# check if you're using gnu core-utils then use --color
test "$(which ls)" = "/opt/local/bin/ls" && (
if [[ "$(which ls)" = "/opt/local/bin/ls" ]] ; then
LS_COMMON="$LS_COMMON --color"
) || (
else
LS_COMMON="$LS_COMMON -G"
)
fi
elif [ "$UNAME" = Linux ]; then
LS_COMMON="$LS_COMMON --color"
fi

View file

@ -14,7 +14,8 @@ if [[ "$SHELL" = "/bin/bash" ]] ; then
function _oarsh_complete_()
{
local word=${COMP_WORDS[COMP_CWORD]}
local list=$(cat $OAR_NODEFILE | uniq | tr '\n' ' ')
local list
list=$(uniq "$OAR_NODEFILE" | tr '\n' ' ')
COMPREPLY=($(compgen -W "$list" -- "${word}"))
}
complete -F _oarsh_complete_ oarsh
@ -24,7 +25,7 @@ fi
__oar_ps1_remaining_time(){
if [ -n "$OAR_JOB_WALLTIME_SECONDS" -a -n "$OAR_NODE_FILE" -a -r "$OAR_NODE_FILE" ]; then
DATE_NOW=$(date +%s)
DATE_JOB_START=$(stat -c %Y $OAR_NODE_FILE)
DATE_JOB_START=$(stat -c %Y "$OAR_NODE_FILE")
DATE_TMP=$OAR_JOB_WALLTIME_SECONDS
((DATE_TMP = (DATE_TMP - DATE_NOW + DATE_JOB_START) / 60))
echo -n "[OAR$OAR_JOB_ID->$DATE_TMP]"
@ -36,6 +37,6 @@ __oar_ps1_remaining_time(){
test -n "$INTERACTIVE" && test -n "$OAR_NODE_FILE" && (
echo "[OAR] OAR_JOB_ID=$OAR_JOB_ID"
echo "[OAR] Your nodes are:"
sort $OAR_NODE_FILE | uniq -c | awk '{printf(" %s*%d\n",$2,$1)}END{printf("\n")}' | sed -e 's/,$//'
sort "$OAR_NODE_FILE" | uniq -c | awk '{printf(" %s*%d\n",$2,$1)}END{printf("\n")}' | sed -e 's/,$//'
)

View file

@ -111,11 +111,12 @@ HISTTIMEFORMAT="[%d/%m/%Y %H:%M:%S] "
## display the current subversion revision (to be used later in the prompt)
__svn_ps1() {
local svnversion=$(svnversion | sed -e "s/[:M]//g")
local svnversion
svnversion=$(svnversion | sed -e "s/[:M]//g")
# Continue if $svnversion is numerical
if let $svnversion 2>/dev/null
then
printf " (svn:%s)" $(svnversion)
printf " (svn:%s)" "$(svnversion)"
fi
}
@ -129,15 +130,10 @@ export GIT_PS1_SHOWDIRTYSTATE=1
# Define some colors to use in the prompt
RESET_COLOR="\[\e[0m\]"
BOLD_COLOR="\[\e[1m\]"
# B&W
WHITE="\[\e[0;37m\]"
GRAY="\[\e[1;30m\]"
BLACK="\[\e[0;30m\]"
# RGB
RED="\[\e[0;31m\]"
GREEN="\[\e[0;32m\]"
BLUE="\[\e[34;1m\]"
# other
YELLOW="\[\e[0;33m\]"
LIGHT_CYAN="\[\e[36;1m\]"
CYAN_UNDERLINE="\[\e[4;36m\]"
@ -154,7 +150,7 @@ fi
# get virtualization information
XENTYPE=""
if [ -f "/sys/hypervisor/uuid" ]; then
if [ $(</sys/hypervisor/uuid) == "00000000-0000-0000-0000-000000000000" ]; then
if [ "$(</sys/hypervisor/uuid)" == "00000000-0000-0000-0000-000000000000" ]; then
XENTYPE=",Dom0"
else
XENTYPE=",DomU"
@ -246,7 +242,7 @@ test -n "$dircolors" && (
test -e "/etc/DIR_COLORS.$TERM" && COLORS="/etc/DIR_COLORS.$TERM"
test -e "$HOME/.dircolors" && COLORS="$HOME/.dircolors"
test ! -e "$COLORS" && COLORS=
eval $($dircolors --sh $COLORS)
eval "$($dircolors --sh $COLORS)"
)
unset dircolors