함수 exec()

(Exec에서 넘어옴)
  다른 뜻에 대해서는 리눅스 exec 문서를 참조하십시오.

1 Go[ | ]

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))
}

2 PHP[ | ]

echo exec('cat /etc/os-release | head -2');
exec('cat /etc/os-release | head -2', $result);
print_r($result);
function execute($command) {
	exec($command, $result);
	return implode("\n", $result);
}
echo execute('cat /etc/os-release | head -2');

3 Python[ | ]

import os
result = os.popen('cat /etc/services | grep ^http').read()
print( result )

4 Perl[ | ]

$result=`cat /etc/services | grep ^http`;
print $result;

5 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}