Fix installation bug.

If the install script is run from an alternative directory
	the use of pwd incorrectly sets the path to .zsh-autosuggesionsrc
This commit is contained in:
Robert Baykov 2015-05-17 23:35:14 -05:00
parent 03c5a52a89
commit c54c2415f0

View file

@ -4,6 +4,7 @@
DESCRIPTION="this script adds/removes a DESCRIPTION="this script adds/removes a
.zsh-autosuggestionsrc reference to your .zshrc file." .zsh-autosuggestionsrc reference to your .zshrc file."
ZSHRC="" ZSHRC=""
PATH_TO_RC="source $HOME/.zsh-autosuggestions/.zsh-autosuggestionsrc"
function usage() function usage()
{ {
@ -16,7 +17,7 @@ function usage()
function install() function install()
{ {
PATH_TO_RC="source "$(pwd)"/.zsh-autosuggestionsrc"
# check if line exists in zshrc, add it if missing # check if line exists in zshrc, add it if missing
if grep -Fxq "$PATH_TO_RC" "$ZSHRC" if grep -Fxq "$PATH_TO_RC" "$ZSHRC"
then then
@ -31,7 +32,6 @@ function install()
function uninstall() function uninstall()
{ {
PATH_TO_RC="source "$(pwd)"/.zsh-autosuggestionsrc"
# check if line exists in zshrc, remove if preset # check if line exists in zshrc, remove if preset
if grep -Fxq "$PATH_TO_RC" "$ZSHRC" if grep -Fxq "$PATH_TO_RC" "$ZSHRC"
then then