You are not logged in.
Occasionally I launch graphical programs from the terminal and they usually spit out what they're doing in the background, I know you can send this output to /dev/null but is there a way to have that is the default setting (ex. not having to type &> /dev/null each time) and then somehow turn console output back on when I want to debug something? I tried creating an alias but that didn't work.
Last edited by brando56894 (2011-07-26 04:17:11)
Offline
Is
[karol@black test]$ jumanji &> log
[karol@black test]$ cat log
** (jumanji:4221): WARNING **: Error loading plugin: libhspell.so.0: cannot open shared object file: No such file or directory
good enough or do you want to detach it from the terminal (so you can issue another command)
[karol@black test]$ nohup jumanji &> log &
[1] 4249
[karol@black test]$ cat log
nohup: ignoring input
** (jumanji:4249): WARNING **: Error loading plugin: libhspell.so.0: cannot open shared object file: No such file or directory
[1]+ Done nohup jumanji &>log
Offline
I just want it so it doesn't dump anything out to the terminal, but without having to type a lot after each command to achieve this. Detaching it would be great because I usually have to open up another terminal when I do this.
Offline
Do you want to use the same file for logging or specify it every time? Overwrite the log or append new info?
Offline
I don't want to use any files. What I want to do is this: <programname> &>/dev/null with out having to type &>/dev/null each time
Last edited by brando56894 (2011-07-26 03:57:33)
Offline
But how will you debug - by launching it again, but w/o redirecting the output to /dev/null?
Offline
By that I meant just removing &>/dev/null or just not typing it if it's an alias or something like that.
Offline
I don't want to use any files. What I want to do is this: programname &>/dev/null with out having to type &>/dev/null
Write a function:
blah() { "$1"&>/dev/null ;}
Launch your programme with
blah programme
Offline
Place
foo () { nohup $@ &>> /path/to/log & }
with your other functions and aliases (like in .bashrc), adjust the function name and log's location.
The log will grow with use, so clear it once in a while.
Don't want a log - here you go
foo () { nohup $@ &>/dev/null & }
The usage is simple:
foo jumanji
I haven't done much testing so it may not always work.
Offline
Thanks, that's what I was looking for!
Offline
bashrun2 provides this via its remote feature. You can simply type the command and press Alt-Enter. Just install bashrun2, run it once and then add this to your .bashrc:
eval "$(bashrun2 --remote-control)"
Offline
I put it in my .bashrc and when I reload .bashrc I get this:
bash: /home/bran/.bashrc: line 12: syntax error near unexpected token `;'
bash: /home/bran/.bashrc: line 12: `no() { "$1"&>/dev/null & ;}'
Offline
What, exactly, did you put in your .bashrc?
Offline
I put it in my .bashrc and when I reload .bashrc I get this:
bash: /home/bran/.bashrc: line 12: syntax error near unexpected token `;' bash: /home/bran/.bashrc: line 12: `no() { "$1"&>/dev/null & ;}'
Remove that '&' and try again. (remember to reload the .bashrc)
What, exactly, did you put in your .bashrc?
He used your function but with "my" '&' - w/o 'nohup'.
Last edited by karol (2011-07-26 04:25:55)
Offline
how would I change my no function so that it detaches?
Offline
how would I change my no function so that it detaches?
Use the one I provided here https://bbs.archlinux.org/viewtopic.php … 05#p965605
foo () { nohup $@ &>/dev/null & }
Offline
Thanks, I wasn't sure if that did the same thing or not.
Offline