I have the following value stored in a variable - pattern
$WS/*.asd
In my environment $WS evaluates to valid directory(/home/administrator/dev/workspaces/). There are some .asd files in this directory. I want to expand the pattern variable to all matching .asd files in this directory. However, I've tried the following commands, but neither of them works:
expand "$pattern"
expand: $WS/*.asd: No such file or directory
ls $pattern
ls: cannot access $WS/*.asd: No such file or directory
eval $pattern
/home/administrator/dev/workspaces/a.asd: Permission denied
echo $pattern
$WS/*.asd
I get the pattern as input. Any idea how I can expand the pattern to a list which includes all matching files.
EDIT: Explain the problem in more details
I may get any combination of env-vars and wildcards in any sequence. For example the input may be: /home/$USER/*/$DIR/*.my_extension. The problem is i want to evaluate all env-vars and expand the wildcards.