[p4] Problem with redirecting stderr.

G Barthelemy gb.perforce at googlemail.com
Wed Sep 19 08:47:00 PDT 2007


For 562 and 565, you should find that you created a file named "1"
that will contain your error message :-). I would have done:
p4 client -o > /tmp/p4mkdeb.21384 2>&1

or if you want both a console output and a file:
p4 client -o >2&1 | tee /tmp/p4mkdeb.21384

I would use p4 login -s rather than p4 client -o, just because I find
login -s more purposeful, but you may have your reasons for using
client -o. Also, /bin/mktemp if you have it is neat for creating
temporary files that don't clash in case you had more than one
instance of your script running...

-- 
Guillaume

On 9/19/07, Steven W. Orr <steveo at syslang.net> wrote:
> In a shell script, I am testing to see if I am logged in. Please bear with
> me. Here are some lines from my console. I am *not* logged in to perforce
>
> 560 > p4 client -o > /tmp/p4mkdeb.21384 2>1
> 561 > cat  /tmp/p4mkdeb.21384
> 562 > p4 client -o 2>&1 | cat > /tmp/p4mkdeb.21384
> 563 > cat  /tmp/p4mkdeb.21384
> Your session has expired, please login again.
> 564 > rm /tmp/p4mkdeb.21384
> 565 > p4 client -o > /tmp/p4mkdeb.21384 2>1
> 566 > cat  /tmp/p4mkdeb.21384
> 567 > p4 client -o
> Your session has expired, please login again.
> 568 > p4 client -o > xxx 2>&1
> 569 > cat xxx
> Your session has expired, please login again.
> 570 > rm /tmp/p4mkdeb.21384
> 571 > p4 client -o 2>&1 | cat > /tmp/p4mkdeb.21384
> 572 > cat  /tmp/p4mkdeb.21384
> Your session has expired, please login again.
> 573 >
>
> On 560, I run client -o and on 561 I get an empty output file.
> On 562, I do the same thing but pass the output through a pipe and
> successfully catch the output.
> On 565, I do it again to prove to myself that I'm not nuts.
> On 567, I just sent it to the console so you can all see further that I'm
> not nuts.
> On 568, I change the output file to being in my local directory and now it
> works on 569.
>
> Server date: 2007/09/19 07:40:56 -0700 PDT
> Server version: P4D/LINUX24X86/2006.1/102189 (2006/06/27)
> Proxy version: P4P/LINUX26X86/2006.1/101890 (2006/06/21)
>
> If anyone can 'splain this one, I'd be fascinated to hear the answer.
>
> --
> Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
> happened but none stranger than this. Does your driver's license say Organ ..0
> Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
> individuals! What if this weren't a hypothetical question?
> steveo at syslang.net
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>


More information about the perforce-user mailing list