opensuse
[Arriba] [Todas las Listas]

Re: [opensuse] bash -- Dónde dentro el heck es "^M...80 espacios...^M"

To: opensuse@xxxxxxxxxxxx
Subject: Re: [opensuse] bash -- Dónde dentro el heck es "^M...80 espacios...^M" Consiguiendo escrito por tee?? (Puede lo cojo?)
From: David Haller <dnh@xxxxxxxxxxxx>
Date: Thu, 29 Sep 2011 10:13:53 +0200
Delivered-to: opensuse@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 29 Sep 2011 04:14:55 -0400
Envelope-to: traductor@xxxxxxxxxxx
In-reply-to: <4E83E337.5070707@antonaylward.com>
List-archive: <http://lists.opensuse.org/opensuse/>
List-help: <mailto:opensuse+help@opensuse.org>
List-owner: <mailto:opensuse+owner@opensuse.org>
List-post: <mailto:opensuse@opensuse.org>
List-subscribe: <mailto:opensuse+subscribe@opensuse.org>
List-unsubscribe: <mailto:opensuse+unsubscribe@opensuse.org>
Mail-followup-to: opensuse@xxxxxxxxxxxx
Mailing-list: contact opensuse+help@xxxxxxxxxxxx; run by mlmmj
Organization: What?
References: <4E83A932.9040005@suddenlinkmail.com> <4E83E337.5070707@antonaylward.com>
User-agent: Mutt/1.5.21 (2010-09-15)
Hola Anton, David[1],

En *Wed, 28 *Sep 2011, Anton *Aylward escribió:
>David *C. *Rankin Dijo el siguiendo en 09/28/2011 07:09 PM:
>># escribe eco
>>de material -*e "\*nTape: $*tapect  --  \*n">>  $*tmpapp
>>eco -*e "\*nCapture Empezó: $(fecha '+%*b %*e %*T')\*n" | *tee -un $*tmpfn
>
>te Es seguro que no significas
>
> eco -*n -*e "\*nTape: $*tapect  --  \*n">>  $*tmpapp
> eco -*n -*e "\*nCapture Empezó: $(fecha '+%*b %*e %*T')\*n" | *tee -un $*tmpfn
>
>Y realizas que lo que ves en la pantalla y lo que va al
>archivo en el segundo caso es dos cosas diferentes.

De hecho, probablemente quiere utilizar:

    *printf "Cinta: %*s -- \*n" "$*tapect" >> $*tmpapp
    fecha '+la Captura Empezó: %*b %*e %*T' | *tee -un $*tmpfn

Recuerda: *strftime/la fecha toma cadenas arbitrarias con *embedded
%-escapadas (aun así la 'fecha parece para añadir un implícito '\*n' al final,
no recuerdo que de *strftime y quizás 'fecha
versiones (o era aquellos *gobbled-por-$() '\*n'?))

[Aquellos '\*n' al principio parecer *dubious, les añade si de hecho querido]

Oh, y *BTW: si tú  mucho redirigiendo *stdout/*stderr material a un
*logfile: *reroute *stdout/*stderr *via *exec en el inicio del guión.

Ve:
    hombre -*P 'menos +"/^*REDIR"' *bash
*e.*g. Hacer un
    *exec &>>$*tmpapp
o un
    *exec 1>>*foo.*log
    *exec 2>>*foo.*err
En el inicio del guión.

También ve 'hombre *logger', *e.*g.

    *foo | *logger -*s -*t *foo

Uso ' #punt.. } | *logger -*s -*t *foo' Para *logging órdenes múltiples.

>En cuanto a los 80 espacios ...  *Dunno.

Ver mi primer correo ;)

*HTH,
-*dnh

[1] *yikes, que siempre mira tan *self-*referential ;)

-- 
justo tuvo una llamada de teléfono grande de un usuario
Su : Cómo lo es siempre mantienes un sentido de humor?
Me  : Porque soy completamente *insane.
Su : ...*yyyyyes. Sí, que lo explicaría. *Bye!            -- *Jim
-- 
A *unsubscribe, *e-correo: *opensuse+unsubscribe@xxxxxxxxxxxx
Puesto que órdenes adicionales, *e-correo: *opensuse+help@xxxxxxxxxxxx


Hello Anton, David[1],

On Wed, 28 Sep 2011, Anton Aylward wrote:
>David C. Rankin said the following on 09/28/2011 07:09 PM:
>># write stuff
>>echo -e "\nTape: $tapect  --  \n">>  $tmpapp
>>echo -e "\nCapture Started: $(date '+%b %e %T')\n" | tee -a $tmpfn
>
>Are you sure that you don't mean
>
> echo -n -e "\nTape: $tapect  --  \n">>  $tmpapp
> echo -n -e "\nCapture Started: $(date '+%b %e %T')\n" | tee -a $tmpfn
>
>And you do realise that what you see on the screen and what goes into
>the file in the second case are two different things.

Actually, he probably wants to use:

    printf "Tape: %s -- \n" "$tapect" >> $tmpapp
    date '+Capture Started: %b %e %T' | tee -a $tmpfn

Remember: strftime/date take arbitrary strings with embedded
%-escapes (though current 'date' seems to add an implicit '\n' at the
end, I don't remember that from strftime and maybe older 'date'
versions (or were those gobbled-by-$() '\n'?))

[those '\n' at the beginning seem dubious, add them if actually wanted]

Oh, and BTW: if you do a lot of redirecting stdout/stderr stuff to a
logfile: reroute stdout/stderr via exec at the start of the script.

See:
    man -P 'less +"/^REDIR"' bash
e.g. do a
    exec &>>$tmpapp
or a
    exec 1>>foo.log
    exec 2>>foo.err
at the start of the script.

Also see 'man logger', e.g.

    foo | logger -s -t foo

Use '{ ... } | logger -s -t foo' for logging multiple commands.

>As for the 80 spaces ...  Dunno.

See my first mail ;)

HTH,
-dnh

[1] yikes, that always looks so self-referential ;)

-- 
just had a great phone call from a user
Her : How is it you always maintain a sense of humour?
Me  : Because I'm completely insane.
Her : ...yyyyyes. Yes, that would explain it. Bye!            -- Jim
-- 
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx


<Anterior por Tema] Tema Actual [Siguiente por Tema>