execute bash program using js

const { exec } = require('child_process');

const bashCommand = 'echo "Hello, World!"';

exec(bashCommand, (error, stdout, stderr) => {
  if (error) {
    console.error(`Error: ${error.message}`);
    return;
  }
  if (stderr) {
    console.error(`stderr: ${stderr}`);
    return;
  }
  console.log(`Output: ${stdout}`);
});