I am writing a makefile which is working on Linux and Macod system. I use the sed
program It has been found that BSD sed and gnu sed differ in a small but significant detail I quote from the man page:
BSD: -I extension ... GNU: -i [SOFFIX], -in-place [= SUFFIX]
then call me on Mac
< The empty string is required after code> sed -i '' -e / foo / bar / 'file.tmp
where -i
, while on the Linux machine I call
sed -i 's / foo / bar /' file.tmp
here The question is:
Is there a safe way to distinguish between two OS in the makefile?
I definitely call the user Makefile.mac
or Makefile.linux
, but instead I avoid it.
safe way -i
option sed
Do not use it. This option is an unused eligible extension and is not part of POSIX.
No comments:
Post a Comment