In a bash script, how do I sanitize user input?
As dj_segfault points out, the shell can do most of this for you. Looks like you’ll have to fall back on something external for lower-casing the string, though. For this you have many options, like the perl one-liners above, etc., but I think tr is probably the simplest. # first, strip underscores CLEAN=${STRING//_/} # next, … Read more