Can I avoid eval
in the below example or is there no other way?
The list of files on variable is dynamic, and I want to cksum all of them.
There are many other files in the directory, but they should be ignored.
$ Z="file1 file4"
$ echo ${Z//\ /,}
file1,file4
$ echo {${Z//\ /,}}
{file1,file4}
$ cksum {file1,file4}
927007485 136284 file1
2748059092 136286 file4
$ cksum {${Z//\ /,}}
cksum: {file1,file4}: No such file or directory
$ eval cksum {${Z//\ /,}}
927007485 136284 file1
2748059092 136286 file4
Z
variable? Consider hard-coding them into an array, instead, or showing a glob pattern that would pick up all & only the files you're interested in. – Jeff Schaller Apr 16 '18 at 13:31cksum $Z
? it works for me. – D'Arcy Nader Apr 16 '18 at 13:32space here
orf*
orfile?
in which case shell globbing get involved. – Jeff Schaller Apr 16 '18 at 13:41