What is Nostr?
kris
npub15a8…hd0k
2024-07-06 13:40:30
in reply to nevent1q…6rwv

kris on Nostr: If you don’t like terminal multiplexers which solve the need to manage much of what ...

If you don’t like terminal multiplexers which solve the need to manage much of what you are trying to address - tmux / screen etc. perhaps check out mosh - https://github.com/mobile-shell/mosh


To the question, perhaps this is a viable scenario to address in the shell natively -


Example - use a combination of redirection and process management tools like `disown`.



1. **Start the command in the background and redirect stdout to a file:**
```bash
command > output.txt 2>&1 &
```

2. **Disown the background process (optional):**
```bash
disown
```

If you need to alter stdout to a file after the task has already been backgrounded, you would generally need to use tools like `nohup`, `screen`, or `tmux`.

OR using `exec` within a shell:

1. **Find the PID of the background process:**
```bash
jobs -l
```

2. **Use `exec` to redirect stdout of that PID:**
```bash
exec 1> output.txt
```

YMMV / not always straightforward and might require additional handling depending on the specific task and shell environment you are using.

You could also send std out to dev null on command execution in shell and then send a sigstop to the PID and fg it, bring std out back to your running shell.
Author Public Key
npub15a8nx85d5arqrvlasm929qmt7g2sgtvp6xfg5e7egcjh780znvps7nhd0k