Skip to content

Commit 3e40b1c

Browse files
committed
Make sure local variables are local
1 parent d09d73c commit 3e40b1c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

notes

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ ls_notes() {
2626
}
2727

2828
find_notes() {
29-
find_output=$(find "$notes_dir" -ipath "$notes_dir/*$**" -type f 2>&1)
30-
find_result=$?
31-
formatted_output=$(printf "$find_output" | without_notes_dir)
29+
local find_output=$(find "$notes_dir" -ipath "$notes_dir/*$**" -type f 2>&1)
30+
local find_result=$?
31+
local formatted_output=$(printf "$find_output" | without_notes_dir)
3232

3333
if [[ $find_result == 0 && "$formatted_output" ]]; then
3434
printf "$formatted_output\n"
@@ -44,9 +44,9 @@ grep_notes() {
4444
return 1
4545
fi
4646

47-
grep_output=$(grep -r "$notes_dir" -li -e "$*" 2>&1)
48-
grep_result=$?
49-
formatted_output=$(printf "$grep_output" | without_notes_dir)
47+
local grep_output=$(grep -r "$notes_dir" -li -e "$*" 2>&1)
48+
local grep_result=$?
49+
local formatted_output=$(printf "$grep_output" | without_notes_dir)
5050

5151
if [[ $grep_result == 0 && "$formatted_output" ]]; then
5252
printf "$formatted_output\n"
@@ -57,7 +57,7 @@ grep_notes() {
5757
}
5858

5959
new_note() {
60-
note_name="$*"
60+
local note_name="$*"
6161
mkdir -p "$(dirname "$notes_dir/$note_name")"
6262
open_note "$note_name.md"
6363
}
@@ -92,7 +92,7 @@ open_something() {
9292
}
9393

9494
open_note() {
95-
note_path=$1
95+
local note_path=$1
9696

9797
if [[ "$note_path" != *.md ]]; then
9898
note_path="$note_path.md"
@@ -131,8 +131,8 @@ EOF
131131
}
132132

133133
main() {
134-
ret=0
135-
cmd=""
134+
local ret=0
135+
local cmd=""
136136

137137
if [ -z "$1" ]; then
138138
printf "No command specified\n\n"

0 commit comments

Comments
 (0)