Using unix time function in QShell

I'm trying to create a QShell command to output the time taken to complete a task. My command seems fine when I run it in cygwin, but doesn't produce anything in QShell. For example, this is the command I'd use to get the real time for ls

(time ls) 2>&1 | grep real | cut -f2 >> log.txt

Am I missing something here?

Answers


QSH is a Unix-like environment. There are some oddities surrounding redirection. IBM have a document called Redirecting Output in Qshell that goes over this in brief. I found the following to work, if clunky:

{ time ls *.txt; } > /dev/null 2> time.txt; grep real time.txt | cut -c10-20 >> log.txt; rm time.txt

I couldn't get STDERR redirected without going to a file.


Need Your Help

maven dependency or jar for oracle.forms.handler.IHandler?

java import

I have searched everywhere on the internet to find a jar or maven dependency for import oracle.forms.handler.IHandler;

Chrome Console Automatic Click

javascript jquery html css google-chrome

I'm on a website that forces me to click numerous elements on the page

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.