From d4eb0e786e3aa5dcc7f9fef734f5ba2607333256 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sat, 29 Jan 2022 22:56:12 -0500 Subject: Allow arguments to nasd script --- home/.local/bin/nasd | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'home/.local/bin/nasd') diff --git a/home/.local/bin/nasd b/home/.local/bin/nasd index d64b2c3a..60241395 100755 --- a/home/.local/bin/nasd +++ b/home/.local/bin/nasd @@ -2,8 +2,13 @@ set -eu dir=$(mktemp -d) -echo 'bits 64' > "${dir}/input" -cat >> "${dir}/input" -nasm -o "${dir}/output" "${dir}/input" || true -ndisasm -b 64 "${dir}/output" || true -rm -r "$dir" +trap 'rm -r "$dir"' EXIT + +echo 'bits 64' >"${dir}/input" +for ins; do + printf '%s\n' "$ins" >>"${dir}/input" +done +[ $# -eq 0 ] && cat >>"${dir}/input" + +nasm -o "${dir}/output" "${dir}/input" +ndisasm -b 64 "${dir}/output" -- cgit 1.4.1