From ecc3ad7cb6aecb6c62aac66e0b840e6cb2f9225d Mon Sep 17 00:00:00 2001
From: Deven Blake
Because executing an empty shellscript file will in most shells do nothing and return an exit status of 0, technically an empty shellscript file is a POSIX-compliant POSIX true(1)
-updated 2021-08-06
+updated 2021-08-18
true(1)
is a tool that only quits silently with an exit status of 0.
@@ -32,8 +32,8 @@ int main(void) { return 0; }
true(1)
implementation in 0 bytes.
-However (TODO) it's to me unknown whether this is implementation-specific or POSIX-specified.
-The usual implementation in POSIX shell is also a one-liner if you ignore the shebang:
+This was the true(1)
implementation on early versions of UNIX, including Research UNIX, System V, and Sun's Solaris, according to both Rob Pike and John Chambers.
+A more explicit implementation also exists in POSIX shell:
#!/bin/sh
@@ -60,8 +60,10 @@ Their
true.c
is 2.3 kilobytes, parses the arguments --helptrue(1)
is not POSIX compliant.