const exec = require('child_process').exec;
exec('cat /dev/urandom |od -x|tr -d ' '|head -n 1', (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
});
上面的shell命令中单引号怎么转义?加反斜杠不行
换双引号?
exec("cat /dev/urandom |od -x|tr -d ' '|head -n 1", (error, stdout, stderr) => {