In a unix script, I have the line
sed -i "/$1/s/a/b" filename
This finds lines containing the string $1 (which is given to the script as a parameter) and, in those lines, replaces "a" with "b".
I would like this to be case-insensitive with respect to $1. For example, if $1 is "foo", then I want the replacement to happen in all lines containing "foo" or "FOO" or "Foo", etc. What is the best way to do this?
(Note: The original version of this post omitted the first forward slash in the code, which is important context for understanding Kusalananda's answer.)