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

This is a common problem I see a lot at my current job and the only advice I can give you is just say no. If you must use something akin to system() there are tools bash provides like:

    printf -v quoted %q "$my_shell_crud"
Or

    printf %s "${my_shell_crud@Q}"
This problem exists in other unfortunate and unlikely places like:

    echo "some script" | at ...some time spec
If you don't want to use bash, the gnu awk info docs has a snippet that you can use in any awk I know of: https://www.gnu.org/software/gawk/manual/html_node/Shell-Quo...


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

Search: