Source code:
#!/usr/bin/env bash
if [[ $# -eq 0 ]]; then
echo "Usage: runasm [ ...]"
echo " - Assemble, link, and run multiple assembly files, then delete them."
echo " - Name of executable is the name of the first file without extension."
exit 1
fi
object_files=()
executable_file=${1%.*}
for assembly_file in "$@"; do
object_file="${assembly_file%.*}.o"
as "${assembly_file}" -o "${object_file}"
if [[ $? -ne 0 ]]; then
exit 1
fi
object_files+=("${object_file}")
done
ld "${object_files[@]}" -o "${executable_file}"
if [[ $? -ne 0 ]]; then
exit 1
fi
./"${executable_file}"
exit_code=$?
rm "${object_files[@]}" "${executable_file}" > /dev/null 2>&1
exit "${exit_code}"
Here is an alternative Piped link(s):
https://piped.video/watch?v=kNKuRdoaNII
Source code:
Piped is a privacy-respecting open-source alternative frontend to YouTube.
I’m open-source; check me out at GitHub.