I am working on a script that involves paths with wildcards. I know the wildcards will match one file only, I just don't know what the file extension will be ahead of time so I am using a wildcard.
The goal here is to find the path to the appropriate file, and then add that path to line 16 of a script.
I have something like this:
path=/path/to/somewhere/fileName*
sed "16 a file=$path" myScript.sh
What I expect to get is this (on line 16):
file=/path/to/somewhere/fileName.extension
But what I get is:
file=/path/to/somewhere/fileName*
For some reason sed is not expanding the wildcard when it adds the contents of $path
and I can't figure out how to make sed do such a thing. I'm looking for a solution that either a) has sed properly expand $path
or b) a way to get $path
to contain the fully expanded string before being passed to sed.