!yzBwvLxciGLIBHonQe:matrix.org

bash

195 Members
Discussions about Bash shell, scripting, etc.36 Servers

Load older messages


SenderMessageTime
13 Jul 2021
@nod0n:matrix.orgNodønBut I would first worry about your function doing the renaming. If you do have, let's say 10 "string" and "replacement string" pairs, I would put them into an associative array and then you can simply iterate over the array. Maybe you can provide some example files and strings for us to understand how it looks in real world.06:56:25
@nerdyanarchist:matrix.org@nerdyanarchist:matrix.org joined the room.18:01:06
14 Jul 2021
@tucked:matrix.orgDavid Tucker joined the room.21:10:49
@tucked:matrix.orgDavid Tucker is there a way to check if a command I ran with & suffixed produced any output? 21:11:39
15 Jul 2021
@tucked:matrix.orgDavid Tucker time python3.8 myscript.py &>somefile & this shows as Stopped shortly after I execute it... any idea why that would happen? 00:40:01
@nod0n:matrix.orgNodøn
In reply to @tucked:matrix.org
time python3.8 myscript.py &>somefile & this shows as Stopped shortly after I execute it... any idea why that would happen?
You did redirect the output into somefile. You can check the output in there.
08:00:36
@nod0n:matrix.orgNodøn

You can put multiple commands into background. If it is for debugging purposes you could also get the exit value like this:

{ sleep 1; echo $?; } &
08:02:41
@nod0n:matrix.orgNodøn You may also have a look at wait. 08:08:33
@tucked:matrix.orgDavid Tucker Nodøn: the first question was actually about a line in the bash version of myscript.py... i ended up porting it to python instead. also, there's nothing in somefile because the proc Stopped :p 16:11:02
* @tucked:matrix.orgDavid Tucker will have to look up wait 16:11:10
* @nod0n:matrix.orgNodøn suggests help wait 16:11:53
@tumtumtumtumtum:matrix.orgTumTumTumTumTum set a profile picture.18:08:51
17 Jul 2021
@phriskybits:phriskybits.ems.host@phriskybits:phriskybits.ems.host joined the room.13:45:52
@phriskybits:phriskybits.ems.host@phriskybits:phriskybits.ems.host left the room.14:16:07
@bifrost:matrix.orgBifrost Bot joined the room.16:50:52
20 Jul 2021
@nerdyanarchist:matrix.org@nerdyanarchist:matrix.org left the room.04:11:36
@isleover:tchncs.de@isleover:tchncs.de left the room.15:43:38
@tucked:matrix.orgDavid Tucker
In reply to @tucked:matrix.org
time python3.8 myscript.py &>somefile & this shows as Stopped shortly after I execute it... any idea why that would happen?
FTR, it doesn't happen with </dev/null: https://stackoverflow.com/a/17626350
18:23:23
21 Jul 2021
@picme:matrix.orgpicmewhat does "disown" really do? any good examples how to use it?04:46:55
@mgoerner:matrix.orgmgoernerdisown somehow detachs your terminal session from a process. Then, when closing the terminal session your process can continue to work. For quite some time I never understood why this was necessary. But when I switched from Bash to ZSH, my GUI applications, which were started from the terminal, kept crashing when I closed my terminal. Using disown solved that. 06:36:29
@mgoerner:matrix.orgmgoerner * disown somehow detachs your terminal session from a process. Then, when closing the terminal session your process can continue to work. For quite some time I never understood why this was necessary. But when I switched from Bash to ZSH, my GUI applications, which were started from the terminal, kept crashing when I closed my terminal. Using disown solved that. 06:36:50
@mgoerner:matrix.orgmgoernerBesides GUI applications you might want to use it over remote sessions. If you do not use tmux or screen, long running processes might crash if you log out from the remote session. Again, I never experienced this issue myself, but that might be due to lucky circumstances. Also, I use tmux for very long now, which prevents such problems too.06:39:34
23 Jul 2021
@darvin44in:converser.eudarvin44in changed their profile picture.07:50:47
@darvin44in:converser.eudarvin44in changed their profile picture.07:52:14
@darvin44in:converser.eudarvin44in changed their profile picture.07:53:38
24 Jul 2021
@yogireborn:matrix.org@yogireborn:matrix.org changed their display name from yogireborn to 666.10:49:01
@yogireborn:matrix.org@yogireborn:matrix.org set a profile picture.10:49:08
@yogireborn:matrix.org@yogireborn:matrix.org left the room.13:03:31
25 Jul 2021
@rudolff:matrix.orgrudolff
In reply to @mgoerner:matrix.org
Besides GUI applications you might want to use it over remote sessions. If you do not use tmux or screen, long running processes might crash if you log out from the remote session. Again, I never experienced this issue myself, but that might be due to lucky circumstances. Also, I use tmux for very long now, which prevents such problems too.
There is no hup , too. I never used disown, I should have practiced it. Whenever I had to left behind a long running process with the risk my connection will drop, and there were no way to install tmux or screen, I went for nohup.
18:40:05
@rudolff:matrix.orgrudolff
In reply to @picme:matrix.org
what does "disown" really do? any good examples how to use it?
When you run anything from the shell, then that process will be spawn as a subprocess to the shell. Try to send it to the background and find PPID for the process. If you disown it, then the PPID will not be any longer your shell. Thus when you log out, the process will keep running. As I mentioned above, I still prefer nohup when I know it will take long.
18:44:58

There are no newer messages yet.


Back to Room List