find /etc -maxdepth 1 -type f | wc -l 32
at ETC directory has 32 files.
ATmega32u4 Code:
#include <Process.h>
void setup() {
Bridge.begin(); // Initialize the Bridge
Serial.begin(9600); // Initialize the Serial
while (!Serial); // Wait until a Serial Monitor is connected.
countfiles();
}
void loop() { }
void countfiles() {
Process p;
p.runShellCommand("find /etc -maxdepth 1 -type f | wc -l");
while (p.running());
while (p.available()) {
int result = p.parseInt(); // look for an integer
Serial.println(result); // print the number as well
break;
}
}
Comments powered by CComment