Skip to content

Commit

Permalink
fix shellcheck warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gturi committed Apr 10, 2022
1 parent d4a3eba commit fbae15c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions installer-for-bash.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash

# gets the absolute path to directory containing this script
DIR=$(dirname $(readlink -f $0))
DIR=$(dirname "$(readlink -f "$0")")

SCRIPT=$DIR/shell-bookmarks.sh
SCRIPT="$DIR/shell-bookmarks.sh"

if [ -f "$SCRIPT" ]; then
# adds to .bashrc
Expand Down
4 changes: 2 additions & 2 deletions installer-for-zsh.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash

# gets the absolute path to directory containing this script
DIR=$(dirname $(readlink -f $0))
DIR=$(dirname "$(readlink -f "$0")")

SCRIPT=$DIR/shell-bookmarks.sh
SCRIPT="$DIR/shell-bookmarks.sh"

if [ -f "$SCRIPT" ]; then
# adds to .zshrc
Expand Down
17 changes: 10 additions & 7 deletions shell-bookmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ if [ -d "$BOOKMARK_DIR" ]; then
[ "$#" -ne "1" ] && echo 'Usage: goto $bookmarkName' && return 1
[ ! -L "$BOOKMARK_DIR/$1" ] && echo "Bookmark named $1 not found" && return 1

cd -P "$BOOKMARK_DIR/$1"
cd -P "$BOOKMARK_DIR/$1" || exit
}
# goto completion function
_goto() {
local IFS=$'\n'
local cur=${COMP_WORDS[COMP_CWORD]}
local BOOKMARK_LIST="$(/bin/ls $BOOKMARK_DIR)"
COMPREPLY=( $( compgen -W "$BOOKMARK_LIST" -- ${cur}) )
local BOOKMARK_LIST
BOOKMARK_LIST="$(/bin/ls "$BOOKMARK_DIR")"
COMPREPLY=( $( compgen -W "$BOOKMARK_LIST" -- "${cur}") )
} && complete -F _goto goto

function bookmark {
Expand Down Expand Up @@ -50,8 +51,9 @@ if [ -d "$BOOKMARK_DIR" ]; then
_unbookmark() {
local IFS=$'\n'
local cur=${COMP_WORDS[COMP_CWORD]}
local BOOKMARK_LIST="$(/bin/ls $BOOKMARK_DIR)"
COMPREPLY=( $( compgen -W "$BOOKMARK_LIST" -- ${cur}) )
local BOOKMARK_LIST
BOOKMARK_LIST="$(/bin/ls "$BOOKMARK_DIR")"
COMPREPLY=( $( compgen -W "$BOOKMARK_LIST" -- "${cur}") )
} && complete -F _unbookmark unbookmark

function rnbookmark {
Expand All @@ -67,8 +69,9 @@ if [ -d "$BOOKMARK_DIR" ]; then
_rnbookmark() {
local IFS=$'\n'
local cur=${COMP_WORDS[COMP_CWORD]}
local BOOKMARK_LIST="$(/bin/ls $BOOKMARK_DIR)"
COMPREPLY=( $( compgen -W "$BOOKMARK_LIST" -- ${cur}) )
local BOOKMARK_LIST
BOOKMARK_LIST="$(/bin/ls "$BOOKMARK_DIR")"
COMPREPLY=( $( compgen -W "$BOOKMARK_LIST" -- "${cur}") )
} && complete -F _rnbookmark rnbookmark

fi

0 comments on commit fbae15c

Please sign in to comment.