Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Every binary executable on a Linux system can be deleted and replaced while the running program is unaffected. Every Python script can be edited while it's running with no effect.

It comes as a surprise the first time you experience it that this rule doesn't follow with bash scripts.




> Every binary executable on a Linux system can be deleted and replaced while the running program is unaffected.

Delete and replace is different than edit in place. I don't know about Linux, but you can edit a binary on FreeBSD which is running, and it affects running copies (it's all memory mapped from the file), and that's why i use install instead of cp to update binaries (including shared libraries)


Well, on unix systems unlinking a file and creating a new one is not the same as modifying the file. If a process has the old file open it will keep that open and remain running with the old file. The new file is a different file.

Is bash closing the file and reopening it, or is the editor writing back to the same filehandle I wonder?


> Every Python script can be edited while it's running with no effect.

Until your script throws an exception, at which point your backtrace will not match the code that was running at all.


It is a surprise, no doubt. On the other hand, bash scripts can contain data and be far larger than available RAM, so just slurping the whole thing up at the start doesn't really work.

That's also true of executables, but bash scrips aren't exec'ed, they are just text files that are read in by the bash executable.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: