Announcement

Collapse
No announcement yet.

time command

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • time command

    Under CentOS i get error message "-f: command not found" when i try to run benchmarks.

    Not sure but if i modify benchmark script from just time to /usr/bin/time all works. Is time some sort of shell's inside command?

    Would it be better to modify all benchmark scripts to use time with full path?

  • #2
    Hmmm I had just modified all the scripts the other day from /usr/bin/time to time. That must have been why I had done it that way in the first place, I'll change it back. Sorry about that.
    Michael Larabel
    https://www.michaellarabel.com/

    Comment


    • #3
      time is a builtin when you use bash as sh.

      Comment


      • #4
        Yes, according to tldp.org

        "As of version 2.0 of Bash, time became a shell reserved word, with slightly altered behavior in a pipeline."

        There is also the times command that gives statistics on the system time elapsed when executing commands.

        Comment


        • #5
          That can't always be the case, since I'm using Bash 3.1
          Code:
          [uncle_fungus@Iguana phoronix-test-suite]$ bash --version
          GNU bash, version 3.1.17(1)-release (i586-mandriva-linux-gnu)
          Copyright (C) 2005 Free Software Foundation, Inc.

          And time in a bash script uses /usr/bin/time

          Comment


          • #6
            Originally posted by uncle_fungus View Post
            That can't always be the case, since I'm using Bash 3.1
            Code:
            [uncle_fungus@Iguana phoronix-test-suite]$ bash --version
            GNU bash, version 3.1.17(1)-release (i586-mandriva-linux-gnu)
            Copyright (C) 2005 Free Software Foundation, Inc.
            And time in a bash script uses /usr/bin/time
            Maybe it's because we are using a newer version of bash.

            Code:
            dean@linux:~> bash --version
            GNU bash, version 3.2.39(1)-release (x86_64-suse-linux-gnu)
            Copyright (C) 2007 Free Software Foundation, Inc.

            Comment


            • #7
              Check this:

              $ bash -c time

              real 0m0.000s
              user 0m0.000s
              sys 0m0.000s
              $ bash -c /usr/bin/time
              Usage: /usr/bin/time [-apvV] [-f format] [-o file] [--append] [--verbose]
              [--portability] [--format=format] [--output=file] [--version]
              [--quiet] [--help] command [arg...]

              Also check

              readlink /bin/sh

              Comment


              • #8
                Originally posted by Kano View Post
                Check this:

                $ bash -c time

                real 0m0.000s
                user 0m0.000s
                sys 0m0.000s
                $ bash -c /usr/bin/time
                Usage: /usr/bin/time [-apvV] [-f format] [-o file] [--append] [--verbose]
                [--portability] [--format=format] [--output=file] [--version]
                [--quiet] [--help] command [arg...]

                Also check

                readlink /bin/sh
                Code:
                dean@linux:~> bash -c time
                
                real    0m0.000s
                user    0m0.000s
                sys     0m0.000s
                dean@linux:~> bash -c /usr/bin/time
                Usage: /usr/bin/time [-apvV] [-f format] [-o file] [--append] [--verbose]
                       [--portability] [--format=format] [--output=file] [--version]
                       [--help] command [arg...]
                dean@linux:~> readlink /bin/sh
                bash
                dean@linux:~>

                Comment


                • #9
                  And thats the standard behaviour if you have /bin/sh as bash to use the bash time builtin. When you write #!/bin/sh scripts with time and you set sh to dash then the external time is used.

                  Comment


                  • #10
                    It appears my bash isn't behaving as "standard" then.

                    Code:
                    [uncle_fungus@Iguana phoronix-test-suite]$ bash -c time
                    Usage: time [-apvV] [-f format] [-o file] [--append] [--verbose]
                           [--portability] [--format=format] [--output=file] [--version]
                           [--quiet] [--help] command [arg...]
                    [uncle_fungus@Iguana phoronix-test-suite]$ bash -c /usr/bin/time
                    Usage: /usr/bin/time [-apvV] [-f format] [-o file] [--append] [--verbose]
                           [--portability] [--format=format] [--output=file] [--version]
                           [--quiet] [--help] command [arg...]
                    [uncle_fungus@Iguana phoronix-test-suite]$ readlink /bin/sh
                    bash

                    Comment

                    Working...
                    X