. Explain the following unexpected result:

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

  1. 👍
  2. 👎
  3. 👁
  1. I will annotate each statement for your information.

    1.$ whereis date
    date: /bin/date ...
    2.$ echo $PATH
    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.

    1. 👍
    2. 👎

Respond to this Question

First Name

Your Response

Similar Questions

  1. calculus

    Find the dimensions of the largest open-top storage bin with a square base and vertical sides that can be made from 108ft^2 of sheet steel. (Neglect the thickness of the steel and assume that there is no waste)

  2. math

    A rectangular bin 4 feet long, 3 feet wide, and 2 feet high is solidly packed with bricks whose dimensions are 8 inches, 4 inches, and 2 inches. The number of bricks in the bin is A. 54 B. 648 C. 1298 D. NONE

  3. Mathematics

    Check my answer?? The bulk food section of a grocery store has two bins with different types of mixed nuts, The first bin contains Walnuts, peanuts and pistachios, The second bin contains pecans, almonds, Brazil Nuts and Walnuts,

  4. Statistics

    Which of the following is not true about histograms? A) The bars must touch each other. B) A histogram may be symmetric or skewed depending on the selection of bin width. C) Each bin must have the same width. D) Histograms may

  1. 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

  2. math

    A standard size of a certain bin holds 2 2/3 gallons . The larger size of that bin is 1 1/4 times larger. How many gallons does the large bin hold ?

  3. algebra

    a storage bin is shaped like a cylinder with a hemisphere shaped top. the cylinder is 45 inches tall. the volume of the bin is 4131 pi cubic inches. find the radius of the bin. i think [4(pi)r(cubed)]/3=volume of hemisphere and h

  4. Maths

    Principal - 6000 Rate - 5% Effective Date - May 15 Maturity Date - November 1 Partial Payment Amount - $1500 Partial Payment Date -August 15 Also Answer the following questions: 1. NUMBER OF DAYS BETWEEN EFFECTIVE DATE AND PARTIAL

  1. Math: Trigonometry/Geometry

    Carlos is planning to build a grain bin with a radius of 15 ft. he reads that the recommended slant of the roof is 25 degrees. He wants the roof to over hang the edge of the bin by 1ft. What should the length of X be? Give answer

  2. Calculus

    A open cylindrical wastepaper bin, of radius r cm and volume V cm^3, is to have a surface area of 5000cm^3. a.Show that V=1/2 *r(5000-pir^2) b.Calculate the maximum possible capacity of the bin.

  3. Math

    A bushel is a unit of volume often used to measure dry, agriculture commodities and one bushel is approximately 32 L. A 1:50 scale model of a grain bin is capable of holding 0.112 bushels. How many bushels can the full size bin

  4. math(simple interest)

    A $9,000 loan is to be repaid in three equal payments occurring 60, 180, and 300 days, respectively, after the date of the loan. Calculate the size of these payments if the interest rate on the loan is 7 1/4%. Use the loan date as

You can view more similar questions or ask a new question.