Is there a way to disable asterisk * interpolation for certain bash commands?
Solution 1:
Yes. You can use set -f
:
set -f
echo * # prints *
# turn glob expansion back on, if you want:
set +f
If you choose this route, you'll have to set it in the terminal where you're calling your script, not in your script itself, as the *
expands before reaching your script as an argument.
As mentioned in the comments, it's probably better to just escape the *
, either via '*'
, "*"
, or \*
.