summaryrefslogtreecommitdiff
path: root/nas.sh
diff options
context:
space:
mode:
authorczjstmax <jstmaxlol@disroot.org>2026-01-14 22:45:56 +0100
committerczjstmax <jstmaxlol@disroot.org>2026-01-14 22:45:56 +0100
commitb31e9b04279f2d721ec8e7dd826a1dc7e351d91a (patch)
tree696577a5ad4c23a780bf375d8a15638f2d4daf14 /nas.sh
parent8ca0b2c4b13964508c5fe09ae52aa61243c9ffcb (diff)
updated `.vimrc`; added random nasm util script i made idk
Signed-off-by: czjstmax <jstmaxlol@disroot.org>
Diffstat (limited to 'nas.sh')
-rwxr-xr-xnas.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/nas.sh b/nas.sh
new file mode 100755
index 0000000..ac67013
--- /dev/null
+++ b/nas.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+if [[ $# -lt 1 ]]; then # nas
+ printf "usage: nas FILEi [FILEo]\n"
+ printf "(!) if FILEo not specified, FILEi will be used.\n"
+ exit 1
+elif [[ $# -ge 2 ]]; then # nas FILEi FILEo | nas ^-h(elp)?$ || nas ^--help$
+ if [[ "$1" =~ ^-h(elp)?$ || "$1" =~ ^--help$ ]]; then
+ # usage # ================> nas ^-h(elp)?$ || nas ^--help$
+ printf "usage: nas FILEi [FILEo]\n"
+ printf "(!) if FILEo not specified, FILEi will be used.\n"
+ exit 0
+ else # ================> nas FILEi FILEo
+ # assemble
+ printf ":> compiling \"%s\" (output=\"%s\")\n" "$1" "$2"
+ nasm -felf64 $1 -o $1.o && ld $1.o -o $2 && rm $1.o
+ exit 0
+ fi
+else
+ # assemble # ================> nas FILEi
+ printf "(!) warning: FILEo not specified. using FILEi (\"%s\") as output FILE\n" "$1"
+ printf ":> compiling \"%s\" (output=\"%s\")\n" "$1" "$1"
+ nasm -felf64 $1 -o $1.o && ld $1.o -o $1 && rm $1.o
+ exit 0
+fi