In a command where we have lot of pipes redirecting their outputs further, is there any way to get to know the value of echo $?
till half of it's execution or till certain number of pipes, as opposed to the overall status of the whole command's?
To exemplify, I'm running below command to get the time stamp of the file to be converted in it's epoch time as,
`ls -lrt --time-style=+"%b %d %Y %H:%M:%S" /some/path/*.dat|head -1|tr -s " "|cut -d " " -f 9|date --date - +%s`
But not getting what I want as I checked manually by splitting it in two halves as,
var1=`ls -lrt --time-style=+"%b %d %Y %H:%M:%S" /some/path/*.dat|head -1|tr -s " "|cut -d " " -f 9`
var2=`date --date=$var1 +%s`
In the first unbroken command I'm still getting an output without any error and is not something I'm expecting, but I don't even want to use two commands too. Could anyone suggest anyway to do so or where exactly I'm erring?
Update:
Why would the below produce today's midnight's epoch(what happens if date's been given -
to get the earlier piped output - though it doesn't work that way) The first question remains unanswered too.
-bash-3.2$ ls -lrt --time-style=+"%b %d %Y %H:%M:%S" *.dat|head -1|tr -s " "|cut -d " " -f9|date --date - +%s; date +%s
1429056000 #Midnight's
1429093077 #Current
PS: It was Not the current epoch.
1429056000