Re: [shell]
This WebDNA talk-list message is from 2002
It keeps the original formatting.
numero = 46389
interpreted = N
texte = Any reason you don't just use WebDNA variables inside the script ..[text]old=<\!--HAS_WEBDNA_TAGS-->[/text][text]new=<\!--HAS_WEBDNA_TAGS-->[/text][text]file=/the/file/here[/text][shell]sed s/[old]/[new]/g [file] > [file].new[/shell][renamefile from=[file].new&to=[file]]We try and keep as much as possible in WebDNA code and just use [shell] forthe minimum possible.Alain> > ok..> i'm not sure actually if i can do that. this is it:> > > [shell]> OLD=<\!--HAS_WEBDNA_TAGS-->> NEW=<\!--HAS_WEBDNA_TAGS-->[include> \/path\/to\/counters\/counter.inc]> FILE=/path/to/my/file.html> sed s/$OLD/$NEW/g $FILE > $FILE.new> /bin/mv $FILE.new $FILE> [/shell]> > didn't work.... the script actally is like this:> > #!/bin/sh> OLD=$1 # first parameter of the script> NEW=$2 # second parameter> shift ; shift # discard the first 2 parameters: the next are the file> for file in $* # for all files given as parameters> do> # replace every occurrence of OLD with NEW, save on a temporary file> sed s/$OLD/$NEW/g ${file} > ${file}.new> # rename the temporary file as the original file> /bin/mv ${file}.new ${file}> done> > and this works on the command line without sudoing to anything...> > y> On Wed, 18 Dec 2002, Kalin Mintchev wrote:> >> >> yea i did. that was my first test... i'll do it again - just a minute...>> >> On Wed, 18 Dec 2002, Alain Russell wrote:>> >>> Ah .. Linux, not OSX>>> Have you tried running the script inside of [shell] as opposed to calling a>>> script ..>>> >>> Take the contents of the script and try it within [shell][/shell]>>> >>>> On Wed, 18 Dec 2002, Alain Russell wrote:>>>> >>>>> If you run this from the command line .. NOT inside [shell] the system>>>>> will>>>>> execute the command as the user 'www' the same as webdna runs as - to see>>>>> if>>>>> it does what it is supposed to.>>>> >>>> that i know. my webdna runs under nobody.. that's the one i used and it>>>> didn't>>>> work..>>>> >>>>> >>>>>> Sudo -u www ./replc.sh <\!--HAS_WEBDNA_TAGS--> .. .etc didn't work....>>>>> >>>>> >>>>> ------------------------------------------------------------->>>>> This message is sent to you because you are subscribed to>>>>> the mailing list
.>>>>> To unsubscribe, E-mail to: >>>>> To switch to the DIGEST mode, E-mail to>>>>> >>>>> Web Archive of this list is at: http://webdna.smithmicro.com/>>>>> >>>> >>>> >>>> ------------------------------------------------------------->>>> This message is sent to you because you are subscribed to>>>> the mailing list .>>>> To unsubscribe, E-mail to: >>>> To switch to the DIGEST mode, E-mail to>>>> >>>> Web Archive of this list is at: http://webdna.smithmicro.com/>>> >>> >>> ------------------------------------------------------------->>> This message is sent to you because you are subscribed to>>> the mailing list .>>> To unsubscribe, E-mail to: >>> To switch to the DIGEST mode, E-mail to>>> >>> Web Archive of this list is at: http://webdna.smithmicro.com/>>> >> >> >> ------------------------------------------------------------->> This message is sent to you because you are subscribed to>> the mailing list .>> To unsubscribe, E-mail to: >> To switch to the DIGEST mode, E-mail to>> >> Web Archive of this list is at: http://webdna.smithmicro.com/>> > > > -------------------------------------------------------------> This message is sent to you because you are subscribed to> the mailing list .> To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to> > Web Archive of this list is at: http://webdna.smithmicro.com/-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Associated Messages, from the most recent to the oldest:
Any reason you don't just use WebDNA variables inside the script ..[text]old=<\!--HAS_WEBDNA_TAGS-->[/text][text]new=<\!--HAS_WEBDNA_TAGS-->[/text][text]file=/the/file/here[/text][shell]sed s/[old]/[new]/g [file] > [file].new[/shell][renamefile from=[file].new&to=[file]]We try and keep as much as possible in WebDNA code and just use [shell] forthe minimum possible.Alain> > ok..> i'm not sure actually if i can do that. this is it:> > > [shell]> OLD=<\!--HAS_WEBDNA_TAGS-->> NEW=<\!--HAS_WEBDNA_TAGS-->[include> \/path\/to\/counters\/counter.inc]> FILE=/path/to/my/file.html> sed s/$OLD/$NEW/g $FILE > $FILE.new> /bin/mv $FILE.new $FILE> [/shell]> > didn't work.... the script actally is like this:> > #!/bin/sh> OLD=$1 # first parameter of the script> NEW=$2 # second parameter> shift ; shift # discard the first 2 parameters: the next are the file> for file in $* # for all files given as parameters> do> # replace every occurrence of OLD with NEW, save on a temporary file> sed s/$OLD/$NEW/g ${file} > ${file}.new> # rename the temporary file as the original file> /bin/mv ${file}.new ${file}> done> > and this works on the command line without sudoing to anything...> > y> On Wed, 18 Dec 2002, Kalin Mintchev wrote:> >> >> yea i did. that was my first test... i'll do it again - just a minute...>> >> On Wed, 18 Dec 2002, Alain Russell wrote:>> >>> Ah .. Linux, not OSX>>> Have you tried running the script inside of [shell] as opposed to calling a>>> script ..>>> >>> Take the contents of the script and try it within [shell][/shell]>>> >>>> On Wed, 18 Dec 2002, Alain Russell wrote:>>>> >>>>> If you run this from the command line .. NOT inside [shell] the system>>>>> will>>>>> execute the command as the user 'www' the same as webdna runs as - to see>>>>> if>>>>> it does what it is supposed to.>>>> >>>> that i know. my webdna runs under nobody.. that's the one i used and it>>>> didn't>>>> work..>>>> >>>>> >>>>>> Sudo -u www ./replc.sh <\!--HAS_WEBDNA_TAGS--> .. .etc didn't work....>>>>> >>>>> >>>>> ------------------------------------------------------------->>>>> This message is sent to you because you are subscribed to>>>>> the mailing list .>>>>> To unsubscribe, E-mail to: >>>>> To switch to the DIGEST mode, E-mail to>>>>> >>>>> Web Archive of this list is at: http://webdna.smithmicro.com/>>>>> >>>> >>>> >>>> ------------------------------------------------------------->>>> This message is sent to you because you are subscribed to>>>> the mailing list .>>>> To unsubscribe, E-mail to: >>>> To switch to the DIGEST mode, E-mail to>>>> >>>> Web Archive of this list is at: http://webdna.smithmicro.com/>>> >>> >>> ------------------------------------------------------------->>> This message is sent to you because you are subscribed to>>> the mailing list .>>> To unsubscribe, E-mail to: >>> To switch to the DIGEST mode, E-mail to>>> >>> Web Archive of this list is at: http://webdna.smithmicro.com/>>> >> >> >> ------------------------------------------------------------->> This message is sent to you because you are subscribed to>> the mailing list .>> To unsubscribe, E-mail to: >> To switch to the DIGEST mode, E-mail to>> >> Web Archive of this list is at: http://webdna.smithmicro.com/>> > > > -------------------------------------------------------------> This message is sent to you because you are subscribed to> the mailing list .> To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to> > Web Archive of this list is at: http://webdna.smithmicro.com/-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Alain Russell
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
[WebDNA] Shucks wendna doesn't work with el capitan (2015)
questions on variations of Ken's [text multi=T]var1=&var2=[/text] (1999)
PCS Frames (1997)
Buying sans cart (1997)
User/pass with tcpconnect (2000)
Execute Applescript (1997)
IIS4 (1998)
WCS Newbie question (1997)
Further tests with the infamous shipCost (1997)
ImageMagick (2005)
Thanks for tips, more quest (1997)
Mac & Internet Explorer, and # of orders/traffic (2000)
Secure server question (1997)
select multiple (1997)
Math with Time (1997)
Listfiles not listing mounted volume (2002)
problems with WebCat-Plugin (1997)
WCS Newbie question (1997)
Install Webcatalog under NT4.0 and Microsoft IIS 2.0 (1997)
Limit to variables passed on to next tpl? (1998)