i'm learning the shell scripting using php
shell.sh
`#!/bin/bash
BASEDIR=$(dirname $0)
echo "BASE DIRECTOY $BASEDIR" ## get base directory
echo "PRESENT WORKING DIRECTORY $PWD" ## get present working directory
declare arr="`dir`"
echo $arr
for i in $arr
do
echo $i
done`
And i'm executing this shell script using php script
phpshell.php
`error_reporting(1);
$output = shell_exec('sh shell.sh');
echo $output;`
So when i'm echoing $arr in shell script, its working fine but when i applying for loop on same array in shell script, it's not printing file names
output
BASE DIRECTOY .
PRESENT WORKING DIRECTORY /cygdrive/c/wamp/www/shell
Copy\ of\ shell.sh htaccess new phpshell.php shell.sh
i tried all answers from stackoverflow and internet but no one solution is working. i'm running this code on wampserver and windows xp sp2. Also i installed a cygwin utility. i think there is no problem with cygwin
Any help would be greatly appreciated....