Skip to content

Instantly share code, notes, and snippets.

@LoonyPandora
Forked from zaius/background.sh
Created January 17, 2011 09:57
Show Gist options
  • Select an option

  • Save LoonyPandora/782671 to your computer and use it in GitHub Desktop.

Select an option

Save LoonyPandora/782671 to your computer and use it in GitHub Desktop.

Revisions

  1. @zaius zaius revised this gist Jan 16, 2011. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion background.sh
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,6 @@ touch /tmp/stderr
    gdb -p $!

    # In GDB

    p dup2(open("/tmp/stdout", 1), 1)
    p dup2(open("/tmp/stderr", 1), 2)
    detach
  2. @zaius zaius revised this gist Jan 16, 2011. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions background.sh
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,12 @@
    ctrl-z
    bg
    gdb -p $!

    # In GDB
    touch /tmp/stdout
    touch /tmp/stderr
    gdb -p $!

    # In GDB

    p dup2(open("/tmp/stdout", 1), 1)
    p dup2(open("/tmp/stderr", 1), 2)
    detach
  3. @zaius zaius created this gist Jan 16, 2011.
    16 changes: 16 additions & 0 deletions background.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    ctrl-z
    bg
    gdb -p $!

    # In GDB
    touch /tmp/stdout
    touch /tmp/stderr
    gdb -p $!
    p dup2(open("/tmp/stdout", 1), 1)
    p dup2(open("/tmp/stderr", 1), 2)
    detach
    quit

    # Back in shell
    disown
    logout