Score:2

is there a shortcut for /dev/stdout like "-" is for /dev/stdin?

co flag

is there a bash shorcut for /dev/stdout like there is "-" for /dev/stdin ?

One of the use cases is to get bash history without line numbers. There is simply no option for that in the history builtin. We can do 'history -w /dev/stdout'. But that's typing 11 characters (/dev/stdout) and I am looking to shorten it to 1 if possible.

in flag
Usually it's `-`.
in flag
Did you see [this answer](https://stackoverflow.com/a/43695212/212107)?
djdomi avatar
za flag
do we only speak about a redirect? wasn't it similar like 2&1> /file?
Sergey Guzenkov avatar
co flag
@GeraldSchneider, '-' is for stdin, not stdout.
in flag
It's a [convention that is used for both](https://unix.stackexchange.com/a/16364/2823). It's not a "shortcut", it needs to be implemented by the application.
Sergey Guzenkov avatar
co flag
@GeraldSchneider, in this case we are talking specifically about bash. AFAIK - is exclusively for stdin. Else can you give an example of it being used as stdout in bash?
in flag
There is an example in the linked answers below. But that won't help you since you already tried it and it obviously isn't working. Did you check out the first solution I linked?
Sergey Guzenkov avatar
co flag
@GeraldSchneider, you mean pipeline into cut? That's not as elegant as '-w /dev/stdout' that I used. Again, there is no problem, as it has been solved in the question '-w /dev/stdout'. The question is if there are shortcuts to /dev/stdout. And it looks like there aren't.
in flag
No, I linked specifically to the answer by setting the `HISTTIMEFORMAT` environment variable.
Sergey Guzenkov avatar
co flag
@djdomi, descriptors do not work with history builtin
Sergey Guzenkov avatar
co flag
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/145912/discussion-between-sergey-guzenkov-and-gerald-schneider).
Sergey Guzenkov avatar
co flag
@GeraldSchneider do you mean that bash does not have any convention for /dev/stdin or /dev/stdout? Bash does not understand '-' at all. But some third party programs do use this convention.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.