Skip to content

Commit 09ae217

Browse files
committed
Don't escape $ inside the init functions
1 parent 0fd098a commit 09ae217

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

wt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,20 @@ update() {
7878
}
7979

8080
init_bash() {
81-
cat <<EOF
81+
cat <<"EOF"
8282
wt() {
8383
if ! command -v wt &> /dev/null; then
84-
echo "wt was not found in your \\\$PATH"
84+
echo 'wt was not found in your $PATH'
8585
return 1
8686
fi
8787
88-
result="\$(command wt "\$@")"
89-
dest_path="\$(echo "\$result" | awk '/^$CHANGE_DIRECTORY_PREFIX.*/ {sub("$CHANGE_DIRECTORY_PREFIX", ""); print; exit}')"
88+
result="$(command wt "$@")"
89+
dest_path="$(echo "$result" | awk '/^$CHANGE_DIRECTORY_PREFIX.*/ {sub("$CHANGE_DIRECTORY_PREFIX", ""); print; exit}')"
9090
91-
if [[ -n "\$dest_path" ]]; then
92-
cd "\$dest_path" || return
93-
elif [[ -n \$result ]]; then
94-
echo "\$result"
91+
if [[ -n "$dest_path" ]]; then
92+
cd "$dest_path" || return
93+
elif [[ -n $result ]]; then
94+
echo "$result"
9595
fi
9696
9797
return 0
@@ -100,20 +100,20 @@ EOF
100100
}
101101

102102
init_fish() {
103-
cat <<EOF
103+
cat <<"EOF"
104104
function wt
105105
if ! command -q wt
106-
echo "wt was not found in your \\\$PATH"
106+
echo 'wt was not found in your $PATH'
107107
return 1
108108
end
109109
110-
set -l result "\$(command wt \$argv)"
111-
set -l dest_path "\$(echo "\$result" | awk '/^$CHANGE_DIRECTORY_PREFIX.*/ {sub("$CHANGE_DIRECTORY_PREFIX", ""); print; exit}')"
110+
set -l result "$(command wt $argv)"
111+
set -l dest_path "$(echo "$result" | awk '/^$CHANGE_DIRECTORY_PREFIX.*/ {sub("$CHANGE_DIRECTORY_PREFIX", ""); print; exit}')"
112112
113-
if test -n "\$dest_path"
114-
cd "\$dest_path"
115-
else if test -n "\$result"
116-
echo "\$result"
113+
if test -n "$dest_path"
114+
cd "$dest_path"
115+
else if test -n "$result"
116+
echo "$result"
117117
end
118118
end
119119
EOF

0 commit comments

Comments
 (0)