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:
Multiple fields on 1 input (1997)
Email Newsletters (2003)
[WebDNA] [thisurl] not clean on fastcgi 7 (2010)
Generating Options for a Form. (1997)
Feedback Please (2003)
WebCat2b13 Command Reference Doc error (1997)
sorting by date (1999)
form data submission gets truncated (1997)
Cart questions (1997)
Need some assistance. (1999)
Anyone using unix? Having problems... (2000)
Limiting user access to .tmpl files (1997)
OT: RAID Options (2004)
[OT] 'Email this story to a friend' (2003)
Speed Optimization - Mac (1997)
Comments in db? (1997)
Emailer choke (1997)
sorted cart? (1998)
Authorizenet - version 3.1 compliance (2002)
Initiating NewCart (1997)