Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Loops 如何在PuTTY终端(SSH连接)中运行一个不包括某些文件名的For循环?_Loops_For Loop_Ssh_Terminal_Putty - Fatal编程技术网

Loops 如何在PuTTY终端(SSH连接)中运行一个不包括某些文件名的For循环?

Loops 如何在PuTTY终端(SSH连接)中运行一个不包括某些文件名的For循环?,loops,for-loop,ssh,terminal,putty,Loops,For Loop,Ssh,Terminal,Putty,在SSH PuTTY连接中,我有一个包含大量文件的目录—我想在FOR循环操作中排除其中一些文件—特别是,我想排除文件名中有“Parrot”或“Tiger”字样的任何文件—下面给出了我要查找的文件列表 ls Zoo_Animals*sas |grep -vi Parrot |grep -vi Tiger 在上下文中,文件名通常显示为Zoo_anies_Monkey_07.sas或Zoo_anies_Lion_12.sas等 因此,如果我想为所有动物运行命令,我通常会使用Unixuse: for

在SSH PuTTY连接中,我有一个包含大量文件的目录—我想在FOR循环操作中排除其中一些文件—特别是,我想排除文件名中有“Parrot”或“Tiger”字样的任何文件—下面给出了我要查找的文件列表

ls Zoo_Animals*sas |grep -vi Parrot |grep -vi Tiger
在上下文中,文件名通常显示为Zoo_anies_Monkey_07.sas或Zoo_anies_Lion_12.sas等

因此,如果我想为所有动物运行命令,我通常会使用Unixuse:

for file in Zoo_Animals*.sas; do <command here> "$file"; done
用于动物园动物*.sas中的文件;执行“$file”;完成
但是,我似乎不知道如何在排除老虎和鹦鹉文件的同时运行FOR循环


任何帮助都将不胜感激

使用
$()


男人发现,看选项-执行
for f in $(ls Zoo_Animals*.sas |grep -vi Parrot |grep -vi Tiger); do echo $f; done