computers

posted by .

. Explain the following unexpected result:

$ whereis date
date: /bin/date ...
$ echo $PATH
.:/usr/local/bin:/usr/bin:/bin
$ cat > date
echo "This is my own version of date."
$ ./date
Fri May 22 11:45:49 PDT 2009

  • computers -

    I will annotate each statement for your information.

    1.$ whereis date
    date: /bin/date ...
    2.$ echo $PATH
    .:/usr/local/bin:/usr/bin:/bin
    3.$ cat > date
    echo "This is my own version of date."
    4.$ ./date
    Fri May 22 11:45:49 PDT 2009

    Annotations for line:
    1. "whereis date" tells us where the executable file "date" is located, according to the current $PATH value. The result tells us that the executable file "date" is found in /bin
    2. echo $PATH
    tells us what is the content of the $PATH environment parameter. Each path is separated by a colon ":".
    3. "cat > date"
    takes standard input (stdin) from the keyboard and put the keyed in content into a new file in the current directory called date. The input should be terminated by a control-d, which is not mentioned in the question.
    The file "date" usually has a permission of 644 or 600 (depending on the computer implementation), which means that it is not executable.
    4. ./date
    attempts to execute the file ./date, but it is not executable (by default). Again, depending on the implementation of the system, it may return
    "permission denied", or
    possibly search for the next directory from the $PATH environment variable, which outputs the current date and time.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. Maths

    Use the United States Rule and/or Banker’s Rule to determine the balance due on the note at the date of maturity. (The effective date is the date the note was written.) Principal - 6000 Rate - 5% Effective Date - May 15 Maturity …
  2. math

    A partial payment is made on the date(s) indicated. Use the United States Rule to determine the balance due on the note at the date of maturity. (The Effective Date is the date the note was written.) Assume the year is not a leap year. …
  3. Math

    The market trades in three fixed-income securities: A, B, and C. Security A is a 2-year bond paying 40 at date 1 and 80 at date 2. Security B is a 1-year bond paying 50 at date 1. Security C pays 30 at date 1 and 40 at date 2. Prices …
  4. Mathematics

    An invoice is dated January 24 with terms 2/10 – 20x. Find the final discount date and the net payment date. The net payment date is 20 days after the final discount date. The final discount date is 2/23. The net payment date is …
  5. math

    From the following information, determine the maturity date of the loan. Enter the full name of the month. (E.g., March) Loan Date Time of Loan (days) Maturity Date February 5 110
  6. Physics Help

    Freshly picked cucumbers are dropped into a bin from a height of 1.25 m above the bottom of the bin. Assuming that the bin is empty, how fast is a cucumber going when it hits the bottom of the bin?
  7. Business Math

    Using the dating method, calculate the discount date and the net date. Unless otherwise specified, the net date is 20 days after the discount date: The date of invoice is April 6th, Terms of sale is 2/10, EOM. What is the Discount …
  8. Math

    50% Rule: The repackaged vial or unit dose must have an expiration date placed on it; but it is not the same expiration date as what is on the stock bottle. You must take the date on the stock bottle and write the half way date between …
  9. Business math

    An invoice is dated January 25 with terms 2/10 -20x. Find the final discount date and the net payment date. The net payment date is 20 days after the final discount date.
  10. buisness

    If you find a job posting for a community college that clearly states that the job will close on 08/15/2017, what does this mean?

More Similar Questions