Reputation: 83
I want to list below multiple file daily so I need the list the file by date should select from system only in file name.
ls -lrt test_20160322.csv
I am getting error while using below command :-
ls -lrt test_${date +"%Y%m%d"}
-bash: ${date +"%Y%m%d"}: bad substitution
Upvotes: 1
Views: 46
Reputation: 47099
Your substitution is wrong you need a command substitution:
ls -lrt test_$(date +"%Y%m%d")
Please note that I changed {
and }
with (
and )
.
Also note that command substitutions will undergo word splitting and should usually be quoted, though in your exact case this will not be the problem.
Upvotes: 2