Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.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
Security 更正shell脚本漏洞_Security_Shell_Scripting - Fatal编程技术网

Security 更正shell脚本漏洞

Security 更正shell脚本漏洞,security,shell,scripting,Security,Shell,Scripting,对于此脚本中的明显漏洞,您可以进行哪些简单的修复 #!/bin/tcsh # foreachfile command # a shell script to apply command to each file in the current directory set ListOfFiles = `ls` set Count = 1 set ListLength = $#ListOfFiles while ($Count <= $ListLength) $argv $Li

对于此脚本中的明显漏洞,您可以进行哪些简单的修复

#!/bin/tcsh
# foreachfile command
# a shell script to apply command to each file in the current directory

set ListOfFiles = `ls`
set Count = 1
set ListLength = $#ListOfFiles
while ($Count <= $ListLength)
        $argv $ListOfFiles[$Count]
        @ Count = $Count + 1
end
#/垃圾箱/垃圾箱
#foreachfile命令
#用于将命令应用于当前目录中的每个文件的shell脚本
set ListOfFiles=`ls`
设置计数=1
设置ListLength=$#ListOfFiles
而($Count
)!/bin/tcsh

#foreachfile命令如果命令理解,您可能还希望在
“$f”
之前插入
--
。我回滚了您的编辑,因为它们使问题毫无意义。
#!/bin/tcsh
# foreachfile command <<<< You gave away the ending!
# a shell script to apply command to each file in the current directory

foreach f (*)
        "$argv" "$f"
end