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

You can set IFS='' globally, which disables splitting. (And you have to make sure it stays that way, since there are some idioms which modify IFS)

Although there is the "empty elision" case related to splitting: if x='', then $x is different than "$x", even if IFS=''.

You could also use zsh which doesn't do word splitting, but does "empty elision". (I'd say zsh is a better interactive shell than a scripting language, but I've seen it used on occasion.)

Or you can use OSH, which will run your bash script as is. And then you can opt into shopt -s simple_word_eval or the group shopt -s oil:basic, and EVERYTHING will be "unmolested", quotes or not:

http://www.oilshell.org/blog/2021/04/simple-word-eval.html



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

Search: