fixed list function and install script bugs

This commit is contained in:
Jon-William Lewis
2016-02-16 11:27:40 -06:00
parent b8c6f1e2b0
commit 6aad964a77
2 changed files with 12 additions and 4 deletions

View File

@@ -22,7 +22,9 @@ if [ "$1" == "--uninstall" ]; then
exit
fi
if [ ! -d ./build ]; then
mkdir build
fi
S=build/sns.sh
@@ -48,7 +50,7 @@ chmod +x "$S"
if [ ! -r "/bin/sns" ]; then
sudo cp "$S" "/bin/sns"
else
if grep "simple note system" "/bin/sns"; then
if grep -i "simple note system" "/bin/sns" >/dev/null; then
sudo rm /bin/sns
sudo cp "$S" "/bin/sns"
fi
@@ -57,7 +59,7 @@ fi
if [ ! -r "/usr/share/bash-completion/completions/sns" ]; then
sudo cp "src/bash-completion/sns" "/usr/share/bash-completion/completions/sns"
else
if grep "simple note system" "/usr/share/bash-completion/completions/sns"; then
if grep -i "simple note system" "/usr/share/bash-completion/completions/sns" >/dev/null; then
sudo rm /bin/sns
sudo cp "$S" "/bin/sns"
fi

View File

@@ -1,4 +1,10 @@
#!/bin/bash
function list(){
# This function, given a folder, $NOTE, will list the contents of $NOTE.
ls "$NOTES_DIR/${NOTE%.*}"
cd "$(dirname "$NOTES_DIR/$NOTE")"
find . -type f -name "*$EXT" | while read file; do
printf "%s\n" "$file"
done
}