this post was submitted on 29 Oct 2023
35 points (76.1% liked)

Linux

48920 readers
1047 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Source code:

#!/usr/bin/env bash

# runasm - Assemble, link, and run multiple assembly files, then delete them.
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
    # Avengers, assemble!
    object_file="${assembly_file%.*}.o"
    as "${assembly_file}" -o "${object_file}"
    if [[ $? -ne 0 ]]; then
        exit 1
    fi
    object_files+=("${object_file}")
done

# Link
ld "${object_files[@]}" -o "${executable_file}"
if [[ $? -ne 0 ]]; then
    exit 1
fi

# Run, remove created files, and return exit code
./"${executable_file}"
exit_code=$?
rm "${object_files[@]}" "${executable_file}" > /dev/null 2>&1
exit "${exit_code}"
top 9 comments
sorted by: hot top controversial new old
[–] [email protected] 52 points 1 year ago

I have two reactions: 1. The headline is rather silly. 2. There's no way this little script, although it might conceivably be useful to someone, needs to be a youtube video.

[–] Poe 22 points 1 year ago (2 children)

Isn't the whole point of assembly that there is no compiler?

[–] SpaceNoodle 18 points 1 year ago

Right, they just use an assembler and a linker ...

[–] [email protected] 6 points 1 year ago

I mean they're not wrong...

This is why my next book will be titled "how to cook dinner without a compiler, GCC 4 to GCC 11 compatible!"

[–] sir_reginald 18 points 1 year ago (1 children)

I was going to click on this until I saw it was a video.

[–] [email protected] 4 points 1 year ago

I need this on a t-shirt

[–] [email protected] 3 points 1 year ago

I'm still super confused by this user's posts lol. I get that (some? most?) of it is satire... but then why all social media engagement farming hashtag nonsense? Or is this all part of the satire...?

[–] [email protected] 1 points 1 year ago

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.

[–] [email protected] 1 points 1 year ago

Perhaps we should reconsider the definition of write-only scripts.