<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>pdkl95</author><text>Regarding the creation and removal of a tempfile (line 72 &amp;amp; 85):&lt;p&gt;&lt;pre&gt;&lt;code&gt;    local tmpFile=&amp;quot;${TMPDIR:-&amp;#x2F;tmp&amp;#x2F;bash-web-server.$$}&amp;quot;

    # ...

    rm &amp;quot;$tmpFile&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
To avoid collisions when the PID is reused, and to clean up0 the tempfile on errors, I recommend using mktemp and trap:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    local tmpfile=&amp;quot;$(mktemp --tmpdir=&amp;quot;${TMPDIR:-&amp;#x2F;tmp}&amp;quot; bash-web-server.XXXXXX)&amp;quot;
    trap &amp;quot;rm -f \&amp;quot;${tmpfile}\&amp;quot;&amp;quot; RETURN EXIT

    # ...

    # Do nothing at the end of the function; trap will
    # remove the file at RETURN automatically.
&lt;/code&gt;&lt;/pre&gt;
Otherwise, I like the implementation! It&amp;#x27;s nice to see good bash techniques like parsing with &amp;quot;IFS=&amp;#x27;&amp;amp;&amp;#x27; read -ra data&amp;quot; and rewriting variables with %%&amp;#x2F;etc.</text><parent_chain></parent_chain></comment><story><title>Show HN: A pure bash web server. No netcat, socat, etc.</title><url>https://github.com/dzove855/Bash-web-server</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>umvi</author><text>Ha, this is more like a puzzle than anything - trying to implement a protocol in a highly restrictive environment.&lt;p&gt;For anyone looking for an easy way to spin up a command line web server, python has one built in, so if you are running linux usually you can do:&lt;p&gt;`python3 -m http.server`&lt;p&gt;From a terminal and it will spin up a web server that serves the current directory. I use this all the time for quick tinkering vs. installing&amp;#x2F;configuring nginx&amp;#x2F;node.js&amp;#x2F;caddy or whatever the cool kids are using these days.</text><parent_chain></parent_chain></comment><story><title>Show HN: A pure bash web server. No netcat, socat, etc.</title><url>https://github.com/dzove855/Bash-web-server</url></story>