Ankit Zalani
Ankit Zalani

Reputation: 3168

What will >_ command do in bash

I saw >_ in bash shell icon in mac and was wondering what it will do.

I tried performing the command but I was not able to figure out what happened. My command prompt silently came again.

It should be doing something, that's why it is in the icon for terminal.

Do anyone know what it does and can it be used for something?

Upvotes: 0

Views: 52

Answers (1)

Jeff Schaller
Jeff Schaller

Reputation: 2547

Running >_ will successfully run (nothing), redirected to a file named _. It's not terribly useful, but that's what it does. The most useful empty redirection I've seen is to empty the contents of a file with it:

> /var/log/app.log

which, if app.log is not open by another process, will result in /var/log/app.log being empty.

Upvotes: 1

Related Questions