Tuesday, July 7, 2015

Bash / PHP Fusion

Bash w/PHP opens a whole new realm of possibilities of systems integration!
>$ var=$(cat << 'EOF' 
<?php
$output = shell_exec('ls -lart');
echo "<pre>$output</pre>";
?>                        
EOF
)

>$ echo "$var" | php
<pre>total 0
-rw-rw-r--  1 cronkilla cronkilla    0 Jul  7 11:24 d
-rw-rw-r--  1 cronkilla cronkilla    0 Jul  7 11:24 c
-rw-rw-r--  1 cronkilla cronkilla    0 Jul  7 11:24 b
-rw-rw-r--  1 cronkilla cronkilla    0 Jul  7 11:24 a
drwxrwxr-x  2 cronkilla cronkilla   40 Jul  7 13:38 f
drwxrwxr-x  3 cronkilla cronkilla  140 Jul  7 13:38 .
drwxrwxrwt 12 root      root      1540 Jul  7 17:40 ..
</pre>

No comments:

Post a Comment