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:
WebMerchant 1.6 and https (1997)
[OT] Airport Problem (2003)
Bug Report, maybe (1997)
Mac System Experience (1998)
Frames (1997)
Tax Laws for Online Sales (2003)
Running a store on BOTH http and https (1998)
[WebDNA] An unknown error occured // Deadlock avoided (2011)
Copyright that puppy (1998)
If search results are blank... (2003)
Who's going to MacWorld? (1999)
Return records from another (1997)
Best Linux/webcat config?? (2000)
Showif, Hideif reverse logic ? (1997)
E-mailer error codes (1997)
One other big addition... (1997)
Search (1997)
Problems passing [SKU] with $Replace in 2.0 (1997)
Nested tags count question (1997)
WebStar 4.2 issues (2000)