In the node world I used shelljs - now I use this module.
import { CommandLineProcessor } from "https://deno.land/x/commandline_processor/commandline-processor.ts"
const commandToBeExecuted = 'deno -V'
console.log(await CommandLineProcessor.process(commandToBeExecuted))
deno run --allow-net --allow-run --allow-read https://deno.land/x/commandline_processor/usage-example.ts
deno test --reload --allow-net --allow-run --allow-read https://deno.land/x/commandline_processor/test.ts
If you like my work please consider downloading the brave browser via my promotion link: https://brave.com/fan464.