templates/index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{{ define "wat" }} <!doctype html> <html> <head> <style> body {color: #ffffff; background-color: #222222; font-family: monospace;} a {color: #ffffff;} pre {color: #ffffff;} sub {color: #4e4e4e;} h1,h2,h4,h4,h5 {color: #ffffff96;} </style> <!-- a j3s.sh production, again, lmao --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Use POSIX Shell</title> </head> <body> <small>#!/bin/sh -eu</small> <br> <small>cat <<EOF</small> <h4># use POSIX shell</h4> <p>POSIX shell is portable, easy to maintain, and works for 99% of scripting use-cases.</p> <p>command list: <a href="https://useposix.sh/commands">https://useposix.sh/commands</a></p> <p>example: <a href="https://useposix.sh/ls">https://useposix.sh/ls</a></p> <p>this site serves as a motivator as well as a desparate plea (USE POSIX SHELL PLS, I AM SO SICK OF ARCANE BASH SCRIPTS) and also a quick reference for POSIX compatability. it will eventually include a POSIX shellcheck interpreter. or something.</p> <!-- lmao escape --> <h4># what is POSIX shell?</h4> <p>POSIX shell is any shell script that adheres to the POSIX standard. <a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html">See this horrible document for excruciating details</a>. basically, if you write a shell script and follow the POSIX standard, you can mostly guarantee that it'll work _almost everywhere_.</p> <h4># there are two types of shell scripts in the world:</h4> <ul>- small, portable, maintainable POSIX shell scripts</ul> <ul>- incomprehensible spaghetti nightmare</ul> <h4># tips</h4> <h4># if it starts feeling confusing as fuck, stop using shell.</h4> <p>when you write only POSIX shell, it becomes very obvious when you should be using a real programming language. your script will begin seeming impossible to reason about. while shell is very powerful, it's also incredibly loose. it is fast and very productive, but becomes impenetrable VERY fast. if you cannot hold the entire script in your head, use a real language. for example, do you:</p> <ul>- need arrays? stop using shell</ul> <ul>- need strong types? stop using shell</ul> <ul>- need a lot of dependencies? stop using shell</ul> <ul>- need compile/runtime safety? stop using shell</ul> <p>see how easy it is? simple, maintainable shell. or none at all.</p> <small>EOF</small> </body> </html> {{ end }}