LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-04-2009, 12:13 PM   #1
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Concurrently Editing and Running Shell Scripts


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?

I'm using Slackware 12.2.
 
Old 04-04-2009, 12:54 PM   #2
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
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.
 
Old 04-04-2009, 01:59 PM   #3
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
I'm using Kate, KDE 3.5.10.

I start the script in Konsole by typing the script name. The script is in the file search path, usually /usr/local/(s)bin.
 
Old 04-04-2009, 02:15 PM   #4
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Preventing multiple instances of a shell script from running concurrently Dave Lerner Programming 17 04-21-2020 12:53 PM
Restrict editing of Shell scripts arunabh_biswas Programming 41 10-28-2008 12:34 AM
Editing PDF from CLI with shell scripts hamtavs Linux - Software 1 04-27-2008 12:35 PM
Editing files from shell scripts? SirRobbin Linux - Newbie 6 03-23-2004 10:27 AM
running shell scripts salparadise Linux - Newbie 2 12-21-2002 05:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration