1

I noticed that many times I need to start a process and disown it immediately. I trying to achieve this in a single line. Any ideas how to do it?

  • 1
    sleep 600 & disown. If it's something else you're after, add more details to your Q. – mosvy Apr 20 at 6:04
  • @mosvy The above thing works for me, but now I am trying to find a way to shorten the command further. What I am looking for is to write a command and then give one or two keystrokes to achieve the disowning action. Like typing "sleep 600 dn" and pressing Enter would start the sleep 600 and disown it, and similarly "nautilus dn" would start nautilus and disown it. – HRK Apr 21 at 9:09
  • 1
    what source do you need? If you don't use the --, bash will complain that -= is an invalid option ;-) – mosvy May 11 at 5:31
  • 1
    more info about tricky characters in aliases in my own answer here, which contains some reference to the bash manpage and standards. – mosvy May 11 at 5:38
  • 1
    ok, in case you didn't know that, using a -- is the standard convention used by unix command to separate switches/options from other arguments, see getopt(). bash's alias builtin is following that convention. – mosvy May 11 at 6:12
1

The following works for me as desired:

intended_process & disown $!

It seems that the $! part is optional

Thanks for the suggestion @mosvy

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.