bash - Touch files from Z->A with a delay -
I have to touch several files in one directory in reverse alphabetical order, with 1 second delay, the name of these files is empty There are places I have tried to do this:
LS | Sort-R | Tr '\ 012' '000' | Xargs-0 touch
and this:
#! / Bin / bash $ i (ls -r) for; Touch "$ i" has slept
But first it makes it very fast and I do not get what I want (to display files in my device), and The second place does not handle the vacancy.
Any thoughts?
EDIT: Sorry, I forgot to add that it would be better to make it as fast as possible, wait 1 second between the files, and I have 60+ files, I have 1 minute Sorry to not wait for more than trouble.
read
will be read in one line at a time:
LS-R | While reading FILE; Alternatively, you can mess with the $ IFS
variable so that only new lines can separate items in . I do not have the syntax, spaces or tabs in the list: $ for FILE in $ (ls -r) = $ '\ n'; Touch "$ FILE" sleep 1
(Panoramas were added so that $ IFS
should be restored later.If you forget and it is a non- Set to standard value),
Anyway, you can also leave sleep by using touch -t
to set a specific timestamp, rather than doing it It looks more difficult, however, so I will leave another daring responder: -)
Comments
Post a Comment