我想制作一个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