- 다른 뜻에 대해서는 리눅스 exec 문서를 참조하십시오.
1 Go[ | ]

Go
Copy
package main
import "fmt"
import "os/exec"
func main() {
cmd := exec.Command("sh", "-c", "cat /etc/services | grep ^http")
stdout, err := cmd.Output()
if err != nil {
panic(err)
}
fmt.Println(string(stdout))
}
Loading
2 PHP[ | ]

PHP
Copy
echo exec('cat /etc/os-release | head -2');
Loading
PHP
Copy
exec('cat /etc/os-release | head -2', $result);
print_r($result);
Loading
PHP
Copy
function execute($command) {
exec($command, $result);
return implode("\n", $result);
}
echo execute('cat /etc/os-release | head -2');
Loading
3 Python[ | ]
Python
Copy
import os
result = os.popen('cat /etc/services | grep ^http').read()
print( result )
Loading
4 Perl[ | ]
Perl
Copy
$result=`cat /etc/services | grep ^http`;
print $result;
Loading
5 같이 보기[ | ]
편집자 Jmnote
로그인하시면 댓글을 쓸 수 있습니다.