I would like to use install
command in order to create a new executable file with pre-populated content (e.g. with single pwd
command in it).
So I've extended this example which creates a new empty executable file:
install -b -m 755 /dev/null newfile
into this one:
install -m755 <(echo pwd) newfile
or:
echo pwd | install -m755 /dev/stdin newfile
Where I expect to create a new newfile
executable file to be created with content pwd
inside.
It works on Linux, however on OS X it fails with the following error:
BSD
install
(/usr/bin/install
)install:
/dev/fd/63
: Inappropriate file type or formatGNU
install
(/usr/local/opt/coreutils/libexec/gnubin/install
)install: skipping file
/dev/fd/63
, as it was replaced while being copied
Why this doesn't work on Unix, but it works on Linux? I'm missing anything? Is there any way to bypass the above warning by using different syntax (without creating a file in separate commands and using chmod
after that)?
On both environments (Linux & OS X) I've the same version of install
:
$ install --version
install (GNU coreutils) 8.23
install -m755 <(echo pwd) newfile
on acentOS 7
machine, and it worked correctly. using the syntaxinstall -m755 <(echo pwd)> newfile
produced the error you are receiving though. I realize this doesn't implicitly help you, but it does show that your premise is sound at least. It should be working – Gravy Oct 13 '15 at 03:36zsh
, you may try the=(cmd)
syntax instead of<(cmd)
. From the man: "If=(...)
is used instead of<(...)
, then the file passed as an argument will be the name of a temporary file containing the output of the list process. This may be used instead of the<
form for a program that expects tolseek
(seelseek(2)
) on the input file." Otherwisemkfifo
is your best bet. – Michaël Nov 17 '15 at 16:09install
is part of the BSD suite, not GNU. Unless you're using homebrew to install custom versions of cmds, anything you use will be the BSD version and therefore differ in functionality from those of GNU Linux. – toxefa Mar 09 '16 at 20:35cp
. This is just one example: http://permalink.gmane.org/gmane.os.cygwin/129935 – toxefa Mar 09 '16 at 20:48install
versions. – kenorb Mar 09 '16 at 21:23