run.cgi
来自「Unix下基于Web的管理工具」· CGI 代码 · 共 35 行
CGI
35 行
#!/usr/local/bin/perl# run.cgi# Run a command, and maybe display it's outputrequire './proc-lib.pl';&ReadParse();&switch_acl_uid();$in{'input'} =~ s/\r//g;if ($in{'mode'}) { # fork and run.. if (!($pid = fork())) { close(STDIN); close(STDOUT); close(STDERR); open(PROC, "| ($in{'cmd'})"); print PROC $in{'input'}; close(PROC); exit; } &redirect("index_tree.cgi"); }else { # run and display output.. $| = 1; &header($text{'run_title'}, ""); print "<hr><p>\n"; print &text('run_output', "<tt>$in{'cmd'}</tt>"),"<p>\n"; print "<pre>"; $got = &safe_process_exec($in{'cmd'}, 0, 0, STDOUT, $in{'input'}, 1); if (!$got) { print "<i>$text{'run_none'}</i>\n"; } print "</pre>\n"; print "<hr>\n"; &footer("", $text{'index'}); }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?