Shell Programming and Scripting

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Mindboggling difference between using "tee" and "/usr/bin/tee" in bash


👤 Login to reply

 
Thread Tools Search this Thread Display Modes
    #1  
Old 11-16-2017
stompadon stompadon is offline
Registered User
 
Join Date: Nov 2017
Last Activity: 16 November 2017, 5:33 PM EST
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
Mindboggling difference between using "tee" and "/usr/bin/tee" in bash

I'm on Ubuntu 14.04 and I manually updated my coreutils so that "tee" is now on version 8.27
I was running a script using bash where there is some write to pipe error at some point causing the tee command to exit abruptly while the script continues to run. The newer version of tee seems to prevent this.

I had installed the newer coreutils to /usr/bin and now running
Code:
bash -c './train.sh | /usr/bin/tee -a latest-log; exit ${PIPESTATUS[0]}'

works but
Code:
bash -c './train.sh | tee -a latest-log; exit ${PIPESTATUS[0]}'

does not

This might seem normal because vanilla "tee" should be the older version. But when I check with
Code:
tee --version

it is showing 8.27!
Code:
which tee

is also showing /usr/bin/tee
Code:
/usr/bin/tee --version

Is of course showing 8.27

This issue is killing me. Please let me know what could be wrong or what I can do to diagnose this.

Last edited by Scott; 11-16-2017 at 04:39 PM.. Reason: Replaced ICODE tags for (multi-line)CODE tags
Sponsored Links
    #2  
Old 11-16-2017
Scott Scott is offline Forum Staff  
Administrator
 
Join Date: Jun 2009
Last Activity: 8 July 2018, 4:41 PM EDT
Posts: 9,062
Thanks: 402
Thanked 1,279 Times in 1,082 Posts
Hmm. That is strange.

Is there an alias to tee?
The Following User Says Thank You to Scott For This Useful Post:
stompadon (11-16-2017)
Sponsored Links
    #3  
Old 11-16-2017
Chubler_XL's Unix or Linux Image
Chubler_XL Chubler_XL is offline Forum Staff  
Moderator
 
Join Date: Oct 2010
Last Activity: 19 July 2018, 8:54 PM EDT
Posts: 3,553
Thanks: 159
Thanked 1,267 Times in 1,161 Posts
What output do you get from

bash -c 'type tee'
Sponsored Links
👤 Login to reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Using "mailx" command to read "to" and "cc" email addreses from input file asjaiswal UNIX for Dummies Questions & Answers 2 10-11-2014 09:32 PM
"Help with bash script" - "License Server and Patch Updates" profileuser UNIX for Dummies Questions & Answers 25 04-01-2014 02:40 PM
awk command to replace ";" with "|" and ""|" at diferent places in line of file shis100 Shell Programming and Scripting 7 03-16-2011 08:59 AM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-20-2007 12:52 AM



All times are GMT -4. The time now is 08:27 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password





Not a Forum Member?
Forgot Password?