SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Recently I ran into something I have seen before but never pursued an answer. I was testing a new (Bourne) shell script. I had the script open in my text editor. When I saved editing mods at a section that had not yet executred, while the script was running, the script would halt with an error. If I edited and saved changes in a section where the code had already executed then I had no problem.
I had always thought a script was launched or executed as a separate process. Apparently not so. Is there a way to concurrently edit and run shell scripts?
What editor were you using, and how are you starting execution on the script? I can't replicate the behavior you are talking about with Vim on my machine.
If I save the script and execute it, any changes I make while the script is running is ignored in the currently running script; they don't take effect until that process has ended and I start it again.
bash interprtes and executes the script line by line. If you edit it during execution, then it loses track of the correct line just as you say. The whole file is not read into memory before beginning execution. For my large bash project, src2pkg, most of the is written as functions in many files which are first sourced with the execution not taking place till all functions are read. this means I can freely edit those files, even while the program is running.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.