How to make GNU grep the default in FreeBSD?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












3















I'm running FreeBSD 9.1-RELEASE. I've installed GNU grep with portmaster textproc/gnugrep.



However the "default" grep for users is still FreeBSD grep.



# /usr/local/bin/grep -V
/usr/local/bin/grep (GNU grep) 2.12

# grep -V
grep (GNU grep) 2.5.1-FreeBSD


I want to make GNU grep the default. I understand that the problem is with the order of directories specified in my PATH environment variable:



# echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin


However, I fear to move the /usr/local/bin entry to the beginning of my PATH. Is it safe?



In Linux distros like Debian such tasks are usually accomplished via dpkg-divert and/or update-alternatives.



What is the best way to do what I want in FreeBSD and not break system upgrades and such?










share|improve this question

















  • 1





    Both of those greps claim to be Gnu Grep, one is older, and may have some FreeBSD mods.

    – ctrl-alt-delor
    Jan 10 at 11:01















3















I'm running FreeBSD 9.1-RELEASE. I've installed GNU grep with portmaster textproc/gnugrep.



However the "default" grep for users is still FreeBSD grep.



# /usr/local/bin/grep -V
/usr/local/bin/grep (GNU grep) 2.12

# grep -V
grep (GNU grep) 2.5.1-FreeBSD


I want to make GNU grep the default. I understand that the problem is with the order of directories specified in my PATH environment variable:



# echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin


However, I fear to move the /usr/local/bin entry to the beginning of my PATH. Is it safe?



In Linux distros like Debian such tasks are usually accomplished via dpkg-divert and/or update-alternatives.



What is the best way to do what I want in FreeBSD and not break system upgrades and such?










share|improve this question

















  • 1





    Both of those greps claim to be Gnu Grep, one is older, and may have some FreeBSD mods.

    – ctrl-alt-delor
    Jan 10 at 11:01













3












3








3








I'm running FreeBSD 9.1-RELEASE. I've installed GNU grep with portmaster textproc/gnugrep.



However the "default" grep for users is still FreeBSD grep.



# /usr/local/bin/grep -V
/usr/local/bin/grep (GNU grep) 2.12

# grep -V
grep (GNU grep) 2.5.1-FreeBSD


I want to make GNU grep the default. I understand that the problem is with the order of directories specified in my PATH environment variable:



# echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin


However, I fear to move the /usr/local/bin entry to the beginning of my PATH. Is it safe?



In Linux distros like Debian such tasks are usually accomplished via dpkg-divert and/or update-alternatives.



What is the best way to do what I want in FreeBSD and not break system upgrades and such?










share|improve this question














I'm running FreeBSD 9.1-RELEASE. I've installed GNU grep with portmaster textproc/gnugrep.



However the "default" grep for users is still FreeBSD grep.



# /usr/local/bin/grep -V
/usr/local/bin/grep (GNU grep) 2.12

# grep -V
grep (GNU grep) 2.5.1-FreeBSD


I want to make GNU grep the default. I understand that the problem is with the order of directories specified in my PATH environment variable:



# echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin


However, I fear to move the /usr/local/bin entry to the beginning of my PATH. Is it safe?



In Linux distros like Debian such tasks are usually accomplished via dpkg-divert and/or update-alternatives.



What is the best way to do what I want in FreeBSD and not break system upgrades and such?







grep freebsd path defaults






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 21 '13 at 10:05









vadippvadipp

1838




1838







  • 1





    Both of those greps claim to be Gnu Grep, one is older, and may have some FreeBSD mods.

    – ctrl-alt-delor
    Jan 10 at 11:01












  • 1





    Both of those greps claim to be Gnu Grep, one is older, and may have some FreeBSD mods.

    – ctrl-alt-delor
    Jan 10 at 11:01







1




1





Both of those greps claim to be Gnu Grep, one is older, and may have some FreeBSD mods.

– ctrl-alt-delor
Jan 10 at 11:01





Both of those greps claim to be Gnu Grep, one is older, and may have some FreeBSD mods.

– ctrl-alt-delor
Jan 10 at 11:01










4 Answers
4






active

oldest

votes


















5














Update: Note this answer is from 2013, it applies to FreeBSD 8.x and earlier. A BSD grep was added in revision 222273 and appeared in FreeBSD-9.0 (oddly that change is missing from the usually comprehensive release notes: Google search). A fully-featured GNU grep continues to be available in the ports collection.




FreeBSD grep is was GNU grep, albeit old and with a few patches applied:



# which grep 
/usr/bin/grep

# /usr/bin/grep -V
grep (GNU grep) 2.5.1-FreeBSD

Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


It has a small number of patches (most of which originate from Fedora Linux), if you have /usr/src/ installed those are detailed in /usr/src/gnu/usr.bin/grep/FREEBSD-upgrade.



If you need something specifically in the port version (2.12 vs 2.5.1) there are many bugfixes, speed improvements, and PCRE support (-P, not enabled in system version), it should be quite safe to reorder your PATH to put /usr/local/bin first, this is what I usually do. (It's good practise to use su - so that root's environment is set correctly, though on FreeBSD the default ~root/.cshrc sets the PATH explicitly.)



Otherwise check your shell man page and set an alias as required, but this is really only for interactive use, shell scripts or Makefiles won't observe it.






share|improve this answer

























  • Yes, I need the -P switch. I'll try changing the order of the PATH. Thanks!

    – vadipp
    Feb 21 '13 at 15:35


















2














Just create an alias, in bash add to your ~/.bash_profile:



alias grep /usr/local/bin/grep


(I believe other shells can do something similar.) That way you can cherry pick individual executables. Even call your alias gnugrep if you don't want to loose the system one.






share|improve this answer






























    1














    Move only grep to start of path.



    • Make a directory mkdir /override/bin.

    • Put a symlink in this directory ln -s /usr/local/bin/grep /override/bin/ or better (if you have gnu ln) ln -s -t /override/bin/ /usr/local/bin/grep (less chase of error).

    • add /override/bin/ to start of path.





    share|improve this answer






























      0














      If you don't want to change your $PATH, alternatively you can just link to the grep you like from an early entry of the $PATH value.



      for example /bin is the second entry of your $PATH and its probably in all users's $PATH values.



      so you could do this as root:



      cd /bin
      ln -s /usr/local/bin/grep





      share|improve this answer























      • This is a very bad idea. Package managers rely on the veracity of their databases to maintain state -- that trust should not be circumvented.

        – Chris Down
        Feb 21 '13 at 10:18











      • @ChrisDown as far as I can tell, this solution doesn't break package manager databases. No port will install binaries to /bin ...

        – vadipp
        Feb 21 '13 at 10:21











      • ok, you are right about that... alternatively. you could add something in your ~/.bashrc like export PATH="~/.bin:$PATH". and then you link from there, like mkdir ~/.bin; cd ~/.bin; ln -s /usr/local/bin/grep. That way only your user is affected.

        – replay
        Feb 21 '13 at 10:21












      • @mauro that's a clean and simple solution, thanks a lot.

        – vadipp
        Feb 21 '13 at 10:22






      • 1





        @vadipp I can't say it will cause problems with package management, I would not do this on FreeBSD because 1: grep is used during startup (it's not invoked before filesystems are mounted, but it's a concern) 2: it might complicate freebsd-update binary updates, similarly freebsd-update IDS if used 3: risk of breaking things by replacing/overriding system binaries with ones that have different switches (e.g. GNU sed has no -E, rc.jail would break if you replaced sed) 4: the alternatives (alias or PATH) are trivial.

        – mr.spuratic
        Feb 21 '13 at 12:32











      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f65603%2fhow-to-make-gnu-grep-the-default-in-freebsd%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      5














      Update: Note this answer is from 2013, it applies to FreeBSD 8.x and earlier. A BSD grep was added in revision 222273 and appeared in FreeBSD-9.0 (oddly that change is missing from the usually comprehensive release notes: Google search). A fully-featured GNU grep continues to be available in the ports collection.




      FreeBSD grep is was GNU grep, albeit old and with a few patches applied:



      # which grep 
      /usr/bin/grep

      # /usr/bin/grep -V
      grep (GNU grep) 2.5.1-FreeBSD

      Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
      This is free software; see the source for copying conditions. There is NO
      warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


      It has a small number of patches (most of which originate from Fedora Linux), if you have /usr/src/ installed those are detailed in /usr/src/gnu/usr.bin/grep/FREEBSD-upgrade.



      If you need something specifically in the port version (2.12 vs 2.5.1) there are many bugfixes, speed improvements, and PCRE support (-P, not enabled in system version), it should be quite safe to reorder your PATH to put /usr/local/bin first, this is what I usually do. (It's good practise to use su - so that root's environment is set correctly, though on FreeBSD the default ~root/.cshrc sets the PATH explicitly.)



      Otherwise check your shell man page and set an alias as required, but this is really only for interactive use, shell scripts or Makefiles won't observe it.






      share|improve this answer

























      • Yes, I need the -P switch. I'll try changing the order of the PATH. Thanks!

        – vadipp
        Feb 21 '13 at 15:35















      5














      Update: Note this answer is from 2013, it applies to FreeBSD 8.x and earlier. A BSD grep was added in revision 222273 and appeared in FreeBSD-9.0 (oddly that change is missing from the usually comprehensive release notes: Google search). A fully-featured GNU grep continues to be available in the ports collection.




      FreeBSD grep is was GNU grep, albeit old and with a few patches applied:



      # which grep 
      /usr/bin/grep

      # /usr/bin/grep -V
      grep (GNU grep) 2.5.1-FreeBSD

      Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
      This is free software; see the source for copying conditions. There is NO
      warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


      It has a small number of patches (most of which originate from Fedora Linux), if you have /usr/src/ installed those are detailed in /usr/src/gnu/usr.bin/grep/FREEBSD-upgrade.



      If you need something specifically in the port version (2.12 vs 2.5.1) there are many bugfixes, speed improvements, and PCRE support (-P, not enabled in system version), it should be quite safe to reorder your PATH to put /usr/local/bin first, this is what I usually do. (It's good practise to use su - so that root's environment is set correctly, though on FreeBSD the default ~root/.cshrc sets the PATH explicitly.)



      Otherwise check your shell man page and set an alias as required, but this is really only for interactive use, shell scripts or Makefiles won't observe it.






      share|improve this answer

























      • Yes, I need the -P switch. I'll try changing the order of the PATH. Thanks!

        – vadipp
        Feb 21 '13 at 15:35













      5












      5








      5







      Update: Note this answer is from 2013, it applies to FreeBSD 8.x and earlier. A BSD grep was added in revision 222273 and appeared in FreeBSD-9.0 (oddly that change is missing from the usually comprehensive release notes: Google search). A fully-featured GNU grep continues to be available in the ports collection.




      FreeBSD grep is was GNU grep, albeit old and with a few patches applied:



      # which grep 
      /usr/bin/grep

      # /usr/bin/grep -V
      grep (GNU grep) 2.5.1-FreeBSD

      Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
      This is free software; see the source for copying conditions. There is NO
      warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


      It has a small number of patches (most of which originate from Fedora Linux), if you have /usr/src/ installed those are detailed in /usr/src/gnu/usr.bin/grep/FREEBSD-upgrade.



      If you need something specifically in the port version (2.12 vs 2.5.1) there are many bugfixes, speed improvements, and PCRE support (-P, not enabled in system version), it should be quite safe to reorder your PATH to put /usr/local/bin first, this is what I usually do. (It's good practise to use su - so that root's environment is set correctly, though on FreeBSD the default ~root/.cshrc sets the PATH explicitly.)



      Otherwise check your shell man page and set an alias as required, but this is really only for interactive use, shell scripts or Makefiles won't observe it.






      share|improve this answer















      Update: Note this answer is from 2013, it applies to FreeBSD 8.x and earlier. A BSD grep was added in revision 222273 and appeared in FreeBSD-9.0 (oddly that change is missing from the usually comprehensive release notes: Google search). A fully-featured GNU grep continues to be available in the ports collection.




      FreeBSD grep is was GNU grep, albeit old and with a few patches applied:



      # which grep 
      /usr/bin/grep

      # /usr/bin/grep -V
      grep (GNU grep) 2.5.1-FreeBSD

      Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
      This is free software; see the source for copying conditions. There is NO
      warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


      It has a small number of patches (most of which originate from Fedora Linux), if you have /usr/src/ installed those are detailed in /usr/src/gnu/usr.bin/grep/FREEBSD-upgrade.



      If you need something specifically in the port version (2.12 vs 2.5.1) there are many bugfixes, speed improvements, and PCRE support (-P, not enabled in system version), it should be quite safe to reorder your PATH to put /usr/local/bin first, this is what I usually do. (It's good practise to use su - so that root's environment is set correctly, though on FreeBSD the default ~root/.cshrc sets the PATH explicitly.)



      Otherwise check your shell man page and set an alias as required, but this is really only for interactive use, shell scripts or Makefiles won't observe it.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jan 10 at 10:56

























      answered Feb 21 '13 at 10:41









      mr.spuraticmr.spuratic

      6,8411028




      6,8411028












      • Yes, I need the -P switch. I'll try changing the order of the PATH. Thanks!

        – vadipp
        Feb 21 '13 at 15:35

















      • Yes, I need the -P switch. I'll try changing the order of the PATH. Thanks!

        – vadipp
        Feb 21 '13 at 15:35
















      Yes, I need the -P switch. I'll try changing the order of the PATH. Thanks!

      – vadipp
      Feb 21 '13 at 15:35





      Yes, I need the -P switch. I'll try changing the order of the PATH. Thanks!

      – vadipp
      Feb 21 '13 at 15:35













      2














      Just create an alias, in bash add to your ~/.bash_profile:



      alias grep /usr/local/bin/grep


      (I believe other shells can do something similar.) That way you can cherry pick individual executables. Even call your alias gnugrep if you don't want to loose the system one.






      share|improve this answer



























        2














        Just create an alias, in bash add to your ~/.bash_profile:



        alias grep /usr/local/bin/grep


        (I believe other shells can do something similar.) That way you can cherry pick individual executables. Even call your alias gnugrep if you don't want to loose the system one.






        share|improve this answer

























          2












          2








          2







          Just create an alias, in bash add to your ~/.bash_profile:



          alias grep /usr/local/bin/grep


          (I believe other shells can do something similar.) That way you can cherry pick individual executables. Even call your alias gnugrep if you don't want to loose the system one.






          share|improve this answer













          Just create an alias, in bash add to your ~/.bash_profile:



          alias grep /usr/local/bin/grep


          (I believe other shells can do something similar.) That way you can cherry pick individual executables. Even call your alias gnugrep if you don't want to loose the system one.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Feb 21 '13 at 19:42









          vonbrandvonbrand

          14.2k22644




          14.2k22644





















              1














              Move only grep to start of path.



              • Make a directory mkdir /override/bin.

              • Put a symlink in this directory ln -s /usr/local/bin/grep /override/bin/ or better (if you have gnu ln) ln -s -t /override/bin/ /usr/local/bin/grep (less chase of error).

              • add /override/bin/ to start of path.





              share|improve this answer



























                1














                Move only grep to start of path.



                • Make a directory mkdir /override/bin.

                • Put a symlink in this directory ln -s /usr/local/bin/grep /override/bin/ or better (if you have gnu ln) ln -s -t /override/bin/ /usr/local/bin/grep (less chase of error).

                • add /override/bin/ to start of path.





                share|improve this answer

























                  1












                  1








                  1







                  Move only grep to start of path.



                  • Make a directory mkdir /override/bin.

                  • Put a symlink in this directory ln -s /usr/local/bin/grep /override/bin/ or better (if you have gnu ln) ln -s -t /override/bin/ /usr/local/bin/grep (less chase of error).

                  • add /override/bin/ to start of path.





                  share|improve this answer













                  Move only grep to start of path.



                  • Make a directory mkdir /override/bin.

                  • Put a symlink in this directory ln -s /usr/local/bin/grep /override/bin/ or better (if you have gnu ln) ln -s -t /override/bin/ /usr/local/bin/grep (less chase of error).

                  • add /override/bin/ to start of path.






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 10 at 11:06









                  ctrl-alt-delorctrl-alt-delor

                  11.2k42058




                  11.2k42058





















                      0














                      If you don't want to change your $PATH, alternatively you can just link to the grep you like from an early entry of the $PATH value.



                      for example /bin is the second entry of your $PATH and its probably in all users's $PATH values.



                      so you could do this as root:



                      cd /bin
                      ln -s /usr/local/bin/grep





                      share|improve this answer























                      • This is a very bad idea. Package managers rely on the veracity of their databases to maintain state -- that trust should not be circumvented.

                        – Chris Down
                        Feb 21 '13 at 10:18











                      • @ChrisDown as far as I can tell, this solution doesn't break package manager databases. No port will install binaries to /bin ...

                        – vadipp
                        Feb 21 '13 at 10:21











                      • ok, you are right about that... alternatively. you could add something in your ~/.bashrc like export PATH="~/.bin:$PATH". and then you link from there, like mkdir ~/.bin; cd ~/.bin; ln -s /usr/local/bin/grep. That way only your user is affected.

                        – replay
                        Feb 21 '13 at 10:21












                      • @mauro that's a clean and simple solution, thanks a lot.

                        – vadipp
                        Feb 21 '13 at 10:22






                      • 1





                        @vadipp I can't say it will cause problems with package management, I would not do this on FreeBSD because 1: grep is used during startup (it's not invoked before filesystems are mounted, but it's a concern) 2: it might complicate freebsd-update binary updates, similarly freebsd-update IDS if used 3: risk of breaking things by replacing/overriding system binaries with ones that have different switches (e.g. GNU sed has no -E, rc.jail would break if you replaced sed) 4: the alternatives (alias or PATH) are trivial.

                        – mr.spuratic
                        Feb 21 '13 at 12:32
















                      0














                      If you don't want to change your $PATH, alternatively you can just link to the grep you like from an early entry of the $PATH value.



                      for example /bin is the second entry of your $PATH and its probably in all users's $PATH values.



                      so you could do this as root:



                      cd /bin
                      ln -s /usr/local/bin/grep





                      share|improve this answer























                      • This is a very bad idea. Package managers rely on the veracity of their databases to maintain state -- that trust should not be circumvented.

                        – Chris Down
                        Feb 21 '13 at 10:18











                      • @ChrisDown as far as I can tell, this solution doesn't break package manager databases. No port will install binaries to /bin ...

                        – vadipp
                        Feb 21 '13 at 10:21











                      • ok, you are right about that... alternatively. you could add something in your ~/.bashrc like export PATH="~/.bin:$PATH". and then you link from there, like mkdir ~/.bin; cd ~/.bin; ln -s /usr/local/bin/grep. That way only your user is affected.

                        – replay
                        Feb 21 '13 at 10:21












                      • @mauro that's a clean and simple solution, thanks a lot.

                        – vadipp
                        Feb 21 '13 at 10:22






                      • 1





                        @vadipp I can't say it will cause problems with package management, I would not do this on FreeBSD because 1: grep is used during startup (it's not invoked before filesystems are mounted, but it's a concern) 2: it might complicate freebsd-update binary updates, similarly freebsd-update IDS if used 3: risk of breaking things by replacing/overriding system binaries with ones that have different switches (e.g. GNU sed has no -E, rc.jail would break if you replaced sed) 4: the alternatives (alias or PATH) are trivial.

                        – mr.spuratic
                        Feb 21 '13 at 12:32














                      0












                      0








                      0







                      If you don't want to change your $PATH, alternatively you can just link to the grep you like from an early entry of the $PATH value.



                      for example /bin is the second entry of your $PATH and its probably in all users's $PATH values.



                      so you could do this as root:



                      cd /bin
                      ln -s /usr/local/bin/grep





                      share|improve this answer













                      If you don't want to change your $PATH, alternatively you can just link to the grep you like from an early entry of the $PATH value.



                      for example /bin is the second entry of your $PATH and its probably in all users's $PATH values.



                      so you could do this as root:



                      cd /bin
                      ln -s /usr/local/bin/grep






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Feb 21 '13 at 10:10









                      replayreplay

                      6,16211628




                      6,16211628












                      • This is a very bad idea. Package managers rely on the veracity of their databases to maintain state -- that trust should not be circumvented.

                        – Chris Down
                        Feb 21 '13 at 10:18











                      • @ChrisDown as far as I can tell, this solution doesn't break package manager databases. No port will install binaries to /bin ...

                        – vadipp
                        Feb 21 '13 at 10:21











                      • ok, you are right about that... alternatively. you could add something in your ~/.bashrc like export PATH="~/.bin:$PATH". and then you link from there, like mkdir ~/.bin; cd ~/.bin; ln -s /usr/local/bin/grep. That way only your user is affected.

                        – replay
                        Feb 21 '13 at 10:21












                      • @mauro that's a clean and simple solution, thanks a lot.

                        – vadipp
                        Feb 21 '13 at 10:22






                      • 1





                        @vadipp I can't say it will cause problems with package management, I would not do this on FreeBSD because 1: grep is used during startup (it's not invoked before filesystems are mounted, but it's a concern) 2: it might complicate freebsd-update binary updates, similarly freebsd-update IDS if used 3: risk of breaking things by replacing/overriding system binaries with ones that have different switches (e.g. GNU sed has no -E, rc.jail would break if you replaced sed) 4: the alternatives (alias or PATH) are trivial.

                        – mr.spuratic
                        Feb 21 '13 at 12:32


















                      • This is a very bad idea. Package managers rely on the veracity of their databases to maintain state -- that trust should not be circumvented.

                        – Chris Down
                        Feb 21 '13 at 10:18











                      • @ChrisDown as far as I can tell, this solution doesn't break package manager databases. No port will install binaries to /bin ...

                        – vadipp
                        Feb 21 '13 at 10:21











                      • ok, you are right about that... alternatively. you could add something in your ~/.bashrc like export PATH="~/.bin:$PATH". and then you link from there, like mkdir ~/.bin; cd ~/.bin; ln -s /usr/local/bin/grep. That way only your user is affected.

                        – replay
                        Feb 21 '13 at 10:21












                      • @mauro that's a clean and simple solution, thanks a lot.

                        – vadipp
                        Feb 21 '13 at 10:22






                      • 1





                        @vadipp I can't say it will cause problems with package management, I would not do this on FreeBSD because 1: grep is used during startup (it's not invoked before filesystems are mounted, but it's a concern) 2: it might complicate freebsd-update binary updates, similarly freebsd-update IDS if used 3: risk of breaking things by replacing/overriding system binaries with ones that have different switches (e.g. GNU sed has no -E, rc.jail would break if you replaced sed) 4: the alternatives (alias or PATH) are trivial.

                        – mr.spuratic
                        Feb 21 '13 at 12:32

















                      This is a very bad idea. Package managers rely on the veracity of their databases to maintain state -- that trust should not be circumvented.

                      – Chris Down
                      Feb 21 '13 at 10:18





                      This is a very bad idea. Package managers rely on the veracity of their databases to maintain state -- that trust should not be circumvented.

                      – Chris Down
                      Feb 21 '13 at 10:18













                      @ChrisDown as far as I can tell, this solution doesn't break package manager databases. No port will install binaries to /bin ...

                      – vadipp
                      Feb 21 '13 at 10:21





                      @ChrisDown as far as I can tell, this solution doesn't break package manager databases. No port will install binaries to /bin ...

                      – vadipp
                      Feb 21 '13 at 10:21













                      ok, you are right about that... alternatively. you could add something in your ~/.bashrc like export PATH="~/.bin:$PATH". and then you link from there, like mkdir ~/.bin; cd ~/.bin; ln -s /usr/local/bin/grep. That way only your user is affected.

                      – replay
                      Feb 21 '13 at 10:21






                      ok, you are right about that... alternatively. you could add something in your ~/.bashrc like export PATH="~/.bin:$PATH". and then you link from there, like mkdir ~/.bin; cd ~/.bin; ln -s /usr/local/bin/grep. That way only your user is affected.

                      – replay
                      Feb 21 '13 at 10:21














                      @mauro that's a clean and simple solution, thanks a lot.

                      – vadipp
                      Feb 21 '13 at 10:22





                      @mauro that's a clean and simple solution, thanks a lot.

                      – vadipp
                      Feb 21 '13 at 10:22




                      1




                      1





                      @vadipp I can't say it will cause problems with package management, I would not do this on FreeBSD because 1: grep is used during startup (it's not invoked before filesystems are mounted, but it's a concern) 2: it might complicate freebsd-update binary updates, similarly freebsd-update IDS if used 3: risk of breaking things by replacing/overriding system binaries with ones that have different switches (e.g. GNU sed has no -E, rc.jail would break if you replaced sed) 4: the alternatives (alias or PATH) are trivial.

                      – mr.spuratic
                      Feb 21 '13 at 12:32






                      @vadipp I can't say it will cause problems with package management, I would not do this on FreeBSD because 1: grep is used during startup (it's not invoked before filesystems are mounted, but it's a concern) 2: it might complicate freebsd-update binary updates, similarly freebsd-update IDS if used 3: risk of breaking things by replacing/overriding system binaries with ones that have different switches (e.g. GNU sed has no -E, rc.jail would break if you replaced sed) 4: the alternatives (alias or PATH) are trivial.

                      – mr.spuratic
                      Feb 21 '13 at 12:32


















                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f65603%2fhow-to-make-gnu-grep-the-default-in-freebsd%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown






                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Bahrain

                      Postfix configuration issue with fips on centos 7; mailgun relay