我需要编写一个Unix脚本,但是我是新手。如果您可以帮助我,我需要帮助。我有两个目录A和B。
我在联机帮助下写了以下脚本(不完整)。感谢您的帮助(如果有)。
#! bin/bash
cd /Test/A
# If more than one directory exist in Directory A then exit copying
fcnt =$(ls *.* | wc)
if [fcnt -gt 1]
then
echo "More than one directory exist"
exit
fi
cp -R /Test/A/dynamicdir* /Test/B
# I need to go into the Dynamic Directory to delete the files,
# but don't know how to get Dynamic Directory name
cd /Test/B/<How to get Dynamic Directory Name?>
rm text1.csv
rm text2.csv
rm text3.csv
quit