4 ms·
Just use shebang https://news.ycombinator.com/item?id=38987109 https://news.ycombinator.com/item?id=38987109 #!/usr/bin/env -S bash -c "docker run -p 8080:808
by dennydai 1y ago
Just use shebang
https://news.ycombinator.com/item?id=38987109 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]*')"
- cess11 1y agoThat's bat guano insane, but I still like it more than TFA.
- renewiltord 1y agoIt's not that crazy. Another fun use is with a `uv run` shebang https://news.ycombinator.com/item?id=42855258 https://news.ycombinator.com/item?id=42855258
- tomjakubowski 1y agoNote 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/ https://crystae.net/posts/two-shebang-papercuts/