Skip to content

Instantly share code, notes, and snippets.

@vielmetti
Created July 19, 2023 05:18
Show Gist options
  • Save vielmetti/3360df282d7cbadf579a09ebb74d536a to your computer and use it in GitHub Desktop.
Save vielmetti/3360df282d7cbadf579a09ebb74d536a to your computer and use it in GitHub Desktop.
hello.sh
#!/bin/sh
# echo is from Doug McIlroy, 1972
# dd ("copy and convert", or "disk destroyer"), 1974
echo hello world | dd conv=ucase
# sed from 1974; sed -E is later
echo "Hello World" | sed -E 's/(.)/\1\n/g'
# awk is from 1977
awk 'BEGIN { print "Hello World" }'
echo "World Hello" | awk '{print $2, $1}'
# rs (reshape) is from 1983, 4.2 BSD
echo H e l l o W o r l d | rs 2 5
# perl, 1987. "Pathologically Eclectic Rubbish Lister"
perl -e 'print "Hello World\n"'
# rev dates back to 1987
echo dlroW olleH | rev
# printf is from 1990, 4.3BSD-Reno
printf "Hello World\n"
# python from 1991; python3 from 2008
python -c 'print("Hello World");'
# encoding in RFC 989, 1987; base64 from John Walker, 1999
echo SGVsbG8gV29ybGQK | base64 -d
# systemd-run is from systemd 203, 2013
sudo systemd-run -t echo "Hello World"
# rustc is from 2015
echo 'fn main() { println!("Hello World"); }' | rustc -o hello - ; ./hello
# jo (JP Mens, 2016) and jq (Stephen Dolan, 2012)
jo first=Hello second=World | jq -j '.first," ",.second,"\n"'
# goawk is POSIX awk in Go, 2018
go/bin/goawk 'BEGIN { print "Hello World" }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment