Execute system command in program and get the result

JavaScript

const execSync = require('child_process').execSync;
let result = execSync('date').toString();
console.log(result);

PHP

<?php
exec('date', $rtn);
print($rtn[0]."\n");

Perl

my $result = `date`;
print($result."\n");

Python

import subprocess
result = subprocess.check_output(["date"], shell=True).decode("UTF-8")
print(result)

Ruby

result = `date`
print(result)

Shell

#!/bin/sh
RESULT=`date`;
echo $RESULT;