![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Writing script for finding a string and replacing | Aditya_IT | Shell Programming and Scripting | 4 | 08-06-2008 12:05 PM |
| replacing parameter in shell script | satgur | Shell Programming and Scripting | 1 | 08-02-2008 05:05 PM |
| Running from Shell Vs running from RC script | vickylife | SUN Solaris | 2 | 07-31-2008 10:01 AM |
| Replacing tape drive in RS/6000 7025 F40 running AIX 4.2.1? | phaedrus | AIX | 2 | 11-12-2007 04:33 PM |
| replacing contents of files from a bash script | HumanBeanDip | Shell Programming and Scripting | 2 | 09-13-2002 03:42 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
|||||
|
Although I'm a newbie, I think the following code clearly shows that this is not the case: Code:
~# cat script echo statement 1 cp $0.update $0 echo statement 2 ~# cat script.update echo statement 3 cp $0.update $0 echo statement 4 ~# bash script statement 1 statement 4 |
|
|||||
|
Here is a solution that I found, Tell me if this looks OK. Code:
~# cat myscript
(( $inside )) || { inside=1; . "$0"; exit; }
echo statement 1
cp $0.update $0
echo statement 2
~# cat myscript.update
(( $inside )) || { inside=1; . "$0"; exit; }
echo statement 3
cp $0.update $0
echo statement 4
~# myscript
statement 1
statement 2
~# myscript
statement 3
statement 4
|
![]() |
| Bookmarks |
| Tags |
| replace, running, script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|