I’m trying to find where two variables are being concatenated in a directory of scripts, but when I try the following:
grep -lire "$DATA_PATH . $AWARDS_YEAR" *
I get “undefined variable” errors…
I thought I could escape the $s by using:
grep -lire "\$DATA_PATH . \$AWARDS_YEAR" *
But I get the same error – so, how do you grep for strings with $s in?
Tcsh is a little different about variables than the usual shells, and it’s the default on FreeBSD.
So, just use single quotes,
'$VAR', or escape the$outside of the quotes:\$"VAR"