on Ask Ubuntu
See other posts from Ask Ubuntu
or by Harish Maralihalli
Published on 2014-08-25T12:51:42Z Indexed on 2014/08/25 16:28 UTC
Read the original article Hit count: 1255
I am trying to assign the latest file name obtained from the below ls command but getting some error, it would be very nice if someone can answer how can I fix this!
fn=`ls -lrt pur_bom_interface_daily*.log | cut -c59-102 | tail -1`
fn=$(ls -lrt pur_bom_interface_daily*.log | cut -c59-102 | tail -1)
ls: 0653-341 The file pur_bom_interface_daily*.log does not exist
I am using
* since there are multiple files starting their name with
pur_bom_interface_daily and concatanated with the date on which they have got created.
© Ask Ubuntu or respective owner