Skip to content

Commit 73f81b8

Browse files
committed
shorter shellcode
1 parent cb8d4cd commit 73f81b8

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

app.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ for (const envln of env.trim().split("\n")) {
7171

7272
const [key] = envln.split("=", 2);
7373
undo += ` if [ \\"$${key}\\" ]; then
74-
export ${key}=\\"$${key}\\"
75-
else
76-
unset ${key}
77-
fi\n`;
74+
export ${key}=\\"$${key}\\"
75+
else
76+
unset ${key}
77+
fi\n`;
7878
}
7979

8080
const dir = Deno.cwd();
@@ -84,14 +84,10 @@ const bye_bye_msg = pkgspecs.map((pkgspec) => `-${pkgspec.slice(1)}`).join(" ");
8484
console.log(`
8585
eval "_pkgx_dev_try_bye() {
8686
suffix=\\"\\\${PWD#\\"${dir}\\"}\\"
87-
if test \\"\\$PWD\\" != \\"${dir}$suffix\\"; then
88-
${undo.trim()}
89-
unset -f _pkgx_dev_try_bye
90-
echo -e \\"\\033[31m${bye_bye_msg}\\033[0m\\" >&2
91-
return 0
92-
else
93-
return 1
94-
fi
87+
[ \\"\\$PWD\\" = \\"${dir}$suffix\\" ] && return 1
88+
echo -e \\"\\033[31m${bye_bye_msg}\\033[0m\\" >&2
89+
${undo.trim()}
90+
unset -f _pkgx_dev_try_bye
9591
}"
9692
9793
set -a

0 commit comments

Comments
 (0)