Hacker News new | past | comments | ask | show | jobs | submit login

Just use shebang

https://news.ycombinator.com/item?id=38987109

#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"






That's bat guano insane, but I still like it more than TFA.

It's not that crazy. Another fun use is with a `uv run` shebang https://news.ycombinator.com/item?id=42855258

Note to others who might like to write long shebangs: the -S argument there to /usr/bin/env is load-bearing, and if you forget it weird stuff will happen, at least on most Linux systems. I wrote about it a few years ago, based on a true story. https://crystae.net/posts/two-shebang-papercuts/



Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: