Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I had something like this implemented for safely executing shell commands, by using metaprogramming:

name="A$ron"

z("echo Hello {name}")

Note that this is not an f-string. The z function expands the variables by parsing this string and accessing its caller's local variables.

https://github.com/NightMachinery/brish




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: