Bash 我无法执行直到昨天才生效的命令
我无法执行此命令Bash 我无法执行直到昨天才生效的命令,bash,Bash,我无法执行此命令 /test/filename_*; do $(wc -l "$file" | cut -d' ' -f1) -eq 1 && m $file ; done 它一直工作到昨天,不知怎么的,现在不工作了。您确定没有使用此命令: for file in /test/filename_*; do [ "$(wc -l "$file" | cut -d' ' -f1)" -eq 1 ] &&
/test/filename_*; do $(wc -l "$file" | cut -d' ' -f1) -eq 1 && m $file ; done
它一直工作到昨天,不知怎么的,现在不工作了。您确定没有使用此命令:
for file in /test/filename_*; do [ "$(wc -l "$file" | cut -d' ' -f1)" -eq 1 ] && rm "$file" ; done
您观察到了什么错误?显然,
/test
目录中的某些内容发生了更改,您是否仍然有文件名*
文件?@AityaKutcharlapati:onedo
确实是不合法的,因为do
是bash的关键字(保留字)。如果在bash命令行中输入do
命令,您将得到相同的错误。无论m
是什么,都会缺少test
您的意思是@Jetchisel?do[$(…)-eq 1]&&…啊,很抱歉!它应该是rm
有关删除文件的信息,请参阅链接副本