Using Cygwin (W10) I've historically used this to measure the execution time within a script:
#!/bin/sh
(time {
sleep 1;
})
I've now moved to Debian (Windows Subsystem for Linux) and the same script gives this error:
Syntax error: "}" unexpected (expecting ")")
I also tried the two suggested scripts here: https://askubuntu.com/a/431184 but both fail:
$ foo() {
sleep 1;
echo "Hello World"
}
$ time foo
Hello World
and
$ foo() {
sleep 1;
echo "Hello World"
}
$ export -f foo
$ echo foo | /usr/bin/time /bin/bash
Hello World
with the same error message:
Syntax error: "(" unexpected
By the way, I've installed /usr/bin/time
.
Could someone please help?
Thank you
EDIT: as requested, the script is simply:
#!/bin/bash
(time {
sleep 1;
})