This is the code:
#!/bin/bash $REPORT_PATH='/data/operational/logs' cp "$(`ls -t | head -1`)" "$REPORT_PATH/new_file"
This gives error 'cp:cannot access pda_param
'.
pda_param file is o/p of ls command.
But this command works when I run it from logs directory. I have also granted full permission to logs directory.
Any ideas?
$()
and and `` are the same. Just use"$(ls -t | head -1)"
– ott-- Mar 7 at 17:37