[Top][All Lists]

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

problem with bash script loading

From: Paulo Nogueira
Subject: problem with bash script loading
Date: Sat, 29 Dec 2018 12:09:49 +0000 (WET)
User-agent: Alpine 2.21 (LFD 202 2017-01-01)

Bash Version: 4.4
Patch Level: 19
Release Status: release

Configuration Information:
Machine: x86_64
OS: linux-gnu
Compiler: gcc


 I've come to the conclusion that bash scripts

 (1) are not entirely loaded in memory at once

 or, at least,

 (2) are re-read (from the disk?) if the file is updated

 Something tells me this is a really bad idea (if it turns
 out to be a "feature" and not a bug), because if a script
 is launched with "&" and then the file is edited/updated,
 the result will be unpredictable.


 Create an empty directory, and then two script files
 s1 and s2, contents given below (enclosed by '--')

 sleep 3
 \rm -f f1

 sleep 1
 \rm -f f2

 Now execute

# touch f1 f2
# ( ./s1 & ) ; sleep 1 ; \cp -f s2 s1

 and see f2 disappear, not f1 .

 Best regards,
  Paulo Nogueira

reply via email to

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