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 workingzsh
, 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.cp
. This is just one example: permalink.gmane.org/gmane.os.cygwin/129935install
versions.