Does "time" work on cygwin?

1,769 views
Skip to first unread message

Jeroen Demeyer

unread,
Feb 27, 2013, 4:19:43 AM2/27/13
to sage-devel
If you have a Cygwin:

please tell me the output of the following shell commands:

$ time true
$ type time
$ /bin/sh -c "time true"
$ bash -c "time true"

Jean-Pierre Flori

unread,
Feb 27, 2013, 4:33:38 AM2/27/13
to sage-...@googlegroups.com
I can tell you this evening.

leif

unread,
Feb 27, 2013, 4:51:37 AM2/27/13
to sage-...@googlegroups.com
FWIW, 'time' is (also) a bash built-in function.


-leif

--
() The ASCII Ribbon Campaign
/\ Help Cure HTML E-Mail

luisfe

unread,
Feb 27, 2013, 6:10:48 AM2/27/13
to sage-...@googlegroups.com
user@frink /opt/sage/sage
$ time true

real    0m0.000s
user    0m0.000s
sys     0m0.000s

user@frink /opt/sage/sage
$ type time
time es una palabra clave del shell

user@frink /opt/sage/sage

$ /bin/sh -c "time true"

real    0m0.000s
user    0m0.000s
sys     0m0.000s

user@frink /opt/sage/sage

$ bash -c "time true"

real    0m0.000s
user    0m0.000s
sys     0m0.000s

Second line means that time is a keyword of the shell

leif

unread,
Feb 27, 2013, 12:21:00 PM2/27/13
to sage-...@googlegroups.com
More interesting would probably be

$ which time

or

$ `which time` true


(/bin/sh is presumably almost always bash on Cygwin.)

Jean-Pierre Flori

unread,
Feb 27, 2013, 4:10:45 PM2/27/13
to sage-...@googlegroups.com
$ time true

real    0m0.000s
user    0m0.000s
sys     0m0.000s

$ type time
time est un mot-clé du shell


$ /bin/sh -c "time true"

real    0m0.138s
user    0m0.000s
sys     0m0.000s


$ bash -c "time true"

real    0m0.001s
user    0m0.000s
sys     0m0.000s

$ which time
which: no time in (/usr/local/bin:/usr/bin:/cygdrive/c/windows/system32:/cygdrive/c/windows:/cygdrive/c/windows/System32/Wbem:/cygdrive/c/windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Broadcom/Broadcom 802.11 Network Adapter/Driver:/cygdrive/c/Program Files/WIDCOMM/Bluetooth Software:/cygdrive/c/Program Files/QuickTime/QTSystem:/usr/lib/lapack)


Jean-Pierre Flori

unread,
Feb 27, 2013, 4:28:41 PM2/27/13
to sage-...@googlegroups.com
Same result on another system.

Jean-Pierre Flori

unread,
Feb 27, 2013, 4:45:21 PM2/27/13
to sage-...@googlegroups.com
But if I do:
{{{
echo "10000000000000000000000000000000000000000" | time QuadraticSieve.exe
}}}
I get
{{{
bash: time : commande introuvable

Jean-Pierre Flori

unread,
Feb 27, 2013, 4:59:55 PM2/27/13
to sage-...@googlegroups.com
Ok, that's because usually there are both a bash builtin and a real command.
http://comments.gmane.org/gmane.os.cygwin/106331

Jean-Pierre Flori

unread,
Feb 27, 2013, 5:04:32 PM2/27/13
to sage-...@googlegroups.com
By the way, the real command is available in http://cygwin.com/packages/time/

Jeroen Demeyer

unread,
Feb 27, 2013, 5:44:09 PM2/27/13
to sage-...@googlegroups.com
On 2013-02-27 22:45, Jean-Pierre Flori wrote:
> But if I do:
> {{{
> echo "10000000000000000000000000000000000000000" | time QuadraticSieve.exe
> }}}
> I get
> {{{
> bash: time : commande introuvable
> }}}
...which has nothing to do with Cygwin.

On my Gentoo Linux system:
cat /dev/null | time cat
bash: time: command not found

The correct syntax is
time cat /dev/null | cat

Jean-Pierre Flori

unread,
Feb 27, 2013, 6:12:33 PM2/27/13
to sage-...@googlegroups.com
So the way time is used in sage/interface/qsieve.y is just broken.
Reply all
Reply to author
Forward
0 new messages