查找文件 ksh
Look for file ksh
我正在努力学习 unix。我想设置一种文件观察器来查找文件和 returns 文件名,以便我可以将它们从源移动到处理文件夹以进行处理。它回显 File Found 我只是不知道如何捕获文件名。
#determines if file exists
if [ -f * ]; then
echo "File found"
else
echo "File not Found"
fi
# returns file to array
#Needs name still
NewFiles[0] =
#output what what found in 0 index
echo "Found File"
echo NewFiles[0]
假设文件没有奇特的名称(嵌入空格或类似名称),您可以使用该方法:
set -- *
[ $# -gt 0 ] && {
echo Found file
echo
}
我正在努力学习 unix。我想设置一种文件观察器来查找文件和 returns 文件名,以便我可以将它们从源移动到处理文件夹以进行处理。它回显 File Found 我只是不知道如何捕获文件名。
#determines if file exists
if [ -f * ]; then
echo "File found"
else
echo "File not Found"
fi
# returns file to array
#Needs name still
NewFiles[0] =
#output what what found in 0 index
echo "Found File"
echo NewFiles[0]
假设文件没有奇特的名称(嵌入空格或类似名称),您可以使用该方法:
set -- *
[ $# -gt 0 ] && {
echo Found file
echo
}