I have a question that I do not know if it is not possible or that I do not know how it is done. If I have this code php:
<?php
$salida = shell_exec('bash prueba.sh');
echo "<pre>$salida</pre>";
exit;
?>
and this in bash:
#!/bin/bash
patch="una_ruta_cualquiera"
lista=$(ls -lt $patch | grep ^d | awk '{print $9}')
for carpeta in $lista; do
#echo $carpeta
listar=$(ls -l $patch/$carpeta | grep -v ^d | awk '{print $9}')
for archivos in $listar; do
echo "$carpeta/$archivos"
done
done
Can I do it in some way in which the result ( echo "$carpeta/$archivos"
) arrived at the php so that it was a $ variable in php and I could work with it?