Я хочу создать сценарий Bash, который может видеть последний созданный каталог, и если он нашел новый каталог, ему нужно скопировать файлы в этот.Скопируйте файлы в новейший каталог
В настоящее время у меня есть этот код
#!/bin/bash
cd /home/test/hello
echo "Searching, the latest made Directory!"
ls -tl | sed -n 2p
#It is not copying yet, because i can't figure out how to let it Copy the stuff to the newest Directory
Этот фрагмент кода показывает новейший из каталога, но я не могу понять, как сделать так, чтобы она затем будет копировать элементы в этот каталог
Итак, как пример.
./script.sh
# Searching the newest Directory
# Found out that the newest Directory is Dir-1
# Copy the files to the Directory Dir-1
-------------------------------------------------------
./script.sh
# Searching the newest Directory
# Found out that the newest Directory is Dir-2
# Copy the files to the Directory\Dir-2
-------------------------------------------------------
./script.sh
# Searching the newest Directory
# Found out that the newest Directory is Dir-3
# Copy the files to the Directory Dir-3
Там, должны быть и другие способы сделать это Исли я думаю .. – Vanture
Потому что я не так хорошо в Bash, но просто нужно иметь это продолжать частный проект меня. – Vanture