Lets consider a bash variable which contains the name (file.txt) of a directory which is wildcarded:
var1='/home/user/file*'
and a variable with the full name var2='/home/user/file.txt'
.
Now if I do echo $var1
it correctly prints file.txt. Now I want to call a programm from shell which uses var1 as one of the arguments. While using var2
works fine, just replacing it with var1
does not do an expansion. Irrelevant on how I give the arguments to said function, how can I make a copy var3
of var1
which is completely identical to var2
, i.e. how can I force that expansion before handing the variable to the function?