0

I've tried:

status=$(git status -s ./$name>&1)
status=$(git status -s ./$name >2 /dev/null >&1)
status=$(git status -s ./$name >2 /dev/null)
status=$(git status -s ./$name > /dev/null 2> &1)

etc, etc. I need to get the response from the git status command, or an empty string but I NEVER want to see a "fatal: Not a git repository" message.

  • your problem is that you are using >2 and not 2> to redirect stderr to /dev/null: the latter works, the former does not. – DopeGhoti Dec 16 '15 at 0:26
1

It sounds like what you want is:

status=$(git status -s ./$name 2> /dev/null)

What happens when you use that that you do not like?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.