Tagged: cli

0

How to run cli/unix commands from nodejs scripts?

There are two ways to do this: child_process.exec(command[, options][, callback]) // ls.js const { exec } = require(‘child_process’); exec(‘ls -lh /usr’, (error, stdout, stderr) => { if (error) { console.error(`exec error: ${error}`); return; }...

0

Autocomplete cli from history

Use the following steps to do the reverse search in your bash history. $ Ctrl + R $(reverse-i-search)`’: [start typing command…] [Tab/Enter] – Tab will complete the command and brings back the CLI. -...

0

$? variable in linux

$? Status of the previous process / command which ran on the shell $ pwd $ echo $? // returns 0 which means the previous command ran sucessfully $ blahCommand $echo $? // returns...