Problem
You want to create a command dynamically in your scriptSolution
#!/bin/bashCMD="$(ls -t L*.log | head -n1)"
eval cp ${CMD} load.dat
The command would be whatever you want in the highlighted brackets above.
The eval command then puts it together. So in the above example I am building a cp command based on the latest log file in the current directory.
"cp L543435.log load.dat"
Comments
Post a Comment