You are not logged in.
Like, I'm not sure if I'm doing this right but I don't use an application launcher since I like how the fish shell does auto completion and remembers commands. So for example I launch mupdf as
mupdf [some file] &
in fish, then launch cmus in the same shell and when mupdf puts some error, like that it can't find a certain string, the output disrupts my cmus interface.
I read somewhere that you can do
exec 2> /dev/null
but fish refuses to accept this and also I don't know if you can put this to .xinit or somewhere to make it permanent.
Also I could manually always do
mupdf [some file] 2> /dev/null &
but that seems clumsy.
Any recommendations? Would creating an alias for any application with the '2> /dev/null' appended to the name be the appreciated way (still seems clumsy to me)?
Last edited by ysetdng (2014-07-17 21:03:44)
Offline
You can't do that with an alias, but a function in your shell rc file will do,
mupdf() { command mupdf "$@" 2> /dev/null; }
This silver ladybug at line 28...
Offline
Or more generic:
back() { nohup $@ >/dev/null 2>&1 & }
This also redirects the stdout - if you don't want to see stderr output, I'm pretty sure you'd also not want stdout. I've also added nohup, so the launched program doesn't get killed if the shell is exited. I have this function in my bashrc, except I use setsid rather than nohup.
Redirecting all stderr from everything permanently would be a horrible idea. What if makepkg or pacman failed for some reason - you'd have no idea why.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Or more generic:
back() { nohup $@ >/dev/null 2>&1 & }
<snip>
except I use setsid rather than nohup
<snip>
How can you call it "back"? Do you think people would have loved sudo so much if it had been called "notme"? Here, market this thing right:
hush () {
setsid "$@" > /dev/null 2>&1
}
Seriously though, thank you for this Trilby.
This silver ladybug at line 28...
Offline
I thought about other names - "bg" was the first, but this is a bash builtin, so that'd be bad. 'hush' is much better for the present purposes, but I wrote the function primarily for "backgrounding" processes rather than just shutting them up.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
How about "scram"? Feels proper in either sense.
"Shut up and fuck off!"
Last edited by lolilolicon (2014-07-17 20:47:35)
This silver ladybug at line 28...
Offline
Cool, thanks! Fish does not want me to use variables as commands, so I used the first approach where I only define the function 'mupdf'. I may switch to zsh soon but for now this is enough since I currently don't have this problem with other software (things like Firefox, where no arguments need to be specified, I launch in dmenu anyway).
Last edited by ysetdng (2014-07-17 21:04:27)
Offline