I’m trying to run the command git branch | grep \* like so:
require('child_process').exec('git branch | grep \*', function(err){
console.log(err);
});
but I keep getting the error { [Error: Command failed: ] killed: false, code: 1, signal: null }
Why is this happening and how can I do this?
Are you trying to run
grep \*? remember you have to escape backslashes in strings.