bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Modifying running script leads to unpredictable result


From: Teika Kazura
Subject: Modifying running script leads to unpredictable result
Date: Sun, 01 Dec 2013 17:31:51 +0900 (JST)

Version: all(?), including bash-4.2, patch 45

Hi, bash developers. If you edit a running bash script file, the result is 
unpredictable. [1] This is bad for long time running scripts.

[1] See for example, http://stackoverflow.com/questions/3398258/

I guess a fix won't be difficult. In fact, a user-side workaround[2] is to put 
the entire code inside a brace, as:
------------------------------------------------------------------------
#!/bin/bash

{
  <put the entrie code here>

  exit
}
------------------------------------------------------------------------

[2] http://stackoverflow.com/a/2358432/780703

By doing so, bash reads the code body before execution. (The last "exit" is 
necessary. See the cited page.)

This seems to mean that with slight changes of the source, bash must be able to 
read the entire script before execution.

This may partly be an enhancement request rather than a bug report. Anyway 
thank you very much for reading.

Best regards,
Teika (Teika kazura)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]