in reply to Downloading only new files added to a local path with Perl (FTP)
epoch=$(perl -MFile::stat -e "print stat('$list')->mtime")
I would guess that $list contains special characters that are preventing correct interpolation. Try:
epoch=$(perl -MFile::stat -se 'print stat($list)->mtime' -- -list="$li +st") # or, better: epoch=$(perl -MFile::stat -wMstrict '-Mvars=$list' -se 'print stat($li +st)->mtime' -- -list="$list")
See perlrun for the -s switch. Of course, the very best way is to rewrite your entire bash script as a Perl script. And why does your bash script start with use strict;? For bash scripts, see Safer bash scripts with set -euxo pipefail.
|
|---|