-1

While looking at my friend's Makefile, I noticed that he used the install shell command. From what I can tell, the command allows you to install and chmod files with one fell swoop. The command came up in a subsequent conversation of ours, and he said he had heard that the command is considered somewhat archaic, and that developers should use cp, mv, chmod etc. for modern projects.

Strangely, this has been my only encounter with the command. This leads me to believe that the command has indeed been rejected and hence forgotten. Is this true? Is there some sort of security flaw with the program? From my possibly naive point of view, using a single command is always better than using many commands

dejay
  • 758
  • 2
  • 6
  • 18

2 Answers2

1

I suspect the answer is that the install command is pretty much only used in scripts and makefiles (such as the automake makefiles that @Jack Kelly describes), and almost never interactively. Thus people rarely see it 'over someone's shoulder', and it doesn't lodge in their consciousness.

It is however, as you say, pretty much exactly the right tool for this job. The problem is that it's not a POSIX command, so it's wise not to use any terribly exotic options. The version of it used in automake makefiles is supplemented by a distributed shell script if the configure script hasn't convinced itself that the local version is sufficiently compatible.

See the autoconf manual's discussion of portable shell scripting, for some useful tips on this general topic.

Norman Gray
  • 11,978
  • 2
  • 33
  • 56
0

Makefiles generated by automake still use it, as evidenced by the line (or similar):

checking for a BSD-compatible install... /usr/bin/install -c

in the output of configure.

Jack Kelly
  • 18,264
  • 2
  • 56
  • 81