Re: [9fans] problem with a here document in rc
> > clearly you did not run this script. this doesn't > > work for the same reason that here docs in functions > > don't work. > > I actually did, but accidentally ran the old unix port. sorry for the noise. ah, yes byron did make here documents work, and i think paul goaded him into adding here strings with three
Re: [9fans] problem with a here document in rc
On Wed, May 8, 2013 at 12:08 AM, erik quanstrom wrote: >> I guess I must be missing something, but this seems equivalent to your >> bash script: >> >> for(i in 1 2 3) { >> cat <> $i >> ! >> } > > clearly you did not run this script. this doesn't > work for the same reason that here docs in functions > don't work. I actually did, but accidentally ran the old unix port. sorry for the noise.
Re: [9fans] problem with a here document in rc
> I guess I must be missing something, but this seems equivalent to your > bash script: > > for(i in 1 2 3) { > cat < $i > ! > } clearly you did not run this script. this doesn't work for the same reason that here docs in functions don't work. - erik
Re: [9fans] problem with a here document in rc
On Mon, May 6, 2013 at 9:27 AM, Rudolf Sykora wrote: > Can the rc example be modified --- still using a here document --- so > that it works? I guess I must be missing something, but this seems equivalent to your bash script: for(i in 1 2 3) { cat <
Re: [9fans] problem with a here document in rc
> Can the rc example be modified --- still using a here document --- so > that it works? no. - erik
Re: [9fans] problem with a here document in rc
Hello, so I repeat my question. While this is possible in bash: ;cat aBash for i in 1 2 3 do cat <
Re: [9fans] problem with a here document in rc
On 2 May 2013 17:24, erik quanstrom wrote: > i usually solve this problem like this > > for(i in 1 2){ > mkdir -p $i || fatal > cp POSCAR $i || fatal > @{ > { > echo 2c > echo $i > echo . > echo w > echo q > } | ed POSCAR > } > } > > - erik So you avoid a here document... Then, is it so that a here document can't ever serve the purpose (ie. it is limited in the way that any present variables are evaluated just once; when then?)? Thanks for a clarification! Ruda
Re: [9fans] problem with a here document in rc
> s = (1 2) > for(i in $s) { > mkdir -p $i > cp POSCAR $i > @{ > cd $i > ed POSCAR <[2]/dev/null > } > } > 2c > $i > . > w > q i usually solve this problem like this for(i in 1 2){ mkdir -p $i || fatal cp POSCAR $i || fatal @{ { echo 2c echo $i echo . echo w echo q } | ed POSCAR } } - erik
[9fans] problem with a here document in rc
Hello, I have a problem with writing correctly a here document in rc. I wrote, say: s = (1 2) for(i in $s) { mkdir -p $i cp POSCAR $i @{ cd $i ed POSCAR <[2]/dev/null } } 2c $i . w q EOF and I wanted to have the 2nd line of individual POSCAR files replaced with the immediate value of $i. But the script doesn't do it, and I don't know if it can be modified in a simple way so that it did. (I could possibly use sed [ie. without a here document] but ...) If anyone can tell me... Thanks! Ruda