Skip to content

Commit

Permalink
some small tweaks;
Browse files Browse the repository at this point in the history
  • Loading branch information
nickjhathaway committed Dec 17, 2016
1 parent 3fbe84c commit 0128ce7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
7 changes: 6 additions & 1 deletion changeLocation.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#!/bin/bash

cd $(getLocation.sh $1)
loc=$(getLocation.sh $1)
if [ $? -eq 0 ]; then
cd $(getLocation.sh $1)
else
echo $loc
fi
3 changes: 2 additions & 1 deletion getLocation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
if [[ $# -ne 1 ]]; then
echo -e "\033[1;38;5;196mTakes only one argument, name for bookmark for current location"
echo -e "eg. getLocation.sh bookmark\033[0m"
exit
exit 1
fi

check=$(egrep "^$1\>" $LOCBOOKHOME/.ohThePlacesIveBeen.txt | cut -d$'\t' -f2)
if [ -n "$check" ]; then
echo $check
else
echo -e "\033[1;38;5;69mNo bookmarked named \033[1;38;5;196m$1\033[0m"
exit 1
fi
3 changes: 2 additions & 1 deletion removeLocation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
if [[ $# -ne 1 ]]; then
echo -e "\033[1;38;5;196mTakes only one argument, name for bookmark for the location to delete"
echo -e "eg. removeLocation.sh bookmarkName\033[0m"
exit
exit 1
fi
# Check to see if bookmark name has already been used
check=$(egrep "^$1\>" $LOCBOOKHOME/.ohThePlacesIveBeen.txt)
Expand All @@ -16,4 +16,5 @@ if [ -n "$check" ]; then
fi
else
echo -e "\033[1;38;5;69mNo bookmarked location saved as \033[1;38;5;196m$1\033[0m"
exit 1
fi
3 changes: 2 additions & 1 deletion saveLocation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
if [[ $# -ne 1 ]]; then
echo -e "\033[1;38;5;196mTakes only one argument, name for bookmark for current location"
echo -e "eg. saveLocation.sh newBookmark\033[0m"
exit
exit 1
fi
#Check to see if the file has been started yet and if hasn't add header
if [ ! -e $LOCBOOKHOME/.ohThePlacesIveBeen.txt ]; then
Expand All @@ -16,6 +16,7 @@ check=$(egrep "^$1\>" $LOCBOOKHOME/.ohThePlacesIveBeen.txt)
if [ -n "$check" ]; then
echo -e "\033[1;38;5;69mLocation Already Saved as "
echo -e "\033[1;38;5;196m$check\033[0m"
exit 1
else
echo -e "$1\t$PWD" >> $LOCBOOKHOME/.ohThePlacesIveBeen.txt
echo -e "LocName\tLocation" > $LOCBOOKHOME/.ohThePlacesIveBeenTemp.txt
Expand Down

0 comments on commit 0128ce7

Please sign in to comment.