I'm new to the shell script, so I have to do something stupid why this won't work:
#!/bin/sh myFile=$1 while read line do ssh $USER@ $line <<ENDSSH ls -d foo* | wc -l count=`ls -d foo* | wc -l` echo $count ENDSSH done <$myfile
Two lines should be printed, and each of them should have the same value ... but they do not. First print statement [result of ls -d foo * | wc -l] has the correct value, the second print statement is incorrect, it always prints blank. Do I need to do something to set the value to $ count?
What am I doing wrong?
thanks
source share