Advertisement
justin_hanekom

grok.sh

May 13th, 2019
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.16 KB | None | 0 0
  1. #!/bin/bash -
  2.  
  3. # File: grok.sh
  4. # Copyright (c) 2018-2019 Justin Hanekom <justin_hanekom@yahoo.com>
  5. # Licensed under the MIT License
  6.  
  7. # Permission is hereby granted, free of charge, to any person obtaining
  8. # a copy of this software and associated documentation files
  9. # (the "Software"), to deal in the Software without restriction,
  10. # including without limitation the rights to use, copy, modify, merge,
  11. # publish, distribute, sublicense, and/or sell copies of the Software,
  12. # and to permit persons to whom the Software is furnished to do so,
  13. # subject to the following conditions:
  14. #
  15. # The above copyright notice and this permission notice shall be
  16. # included in all copies or substantial portions of the Software.
  17. #
  18. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  19. # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20. # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  21. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  22. # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  23. # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  24. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25.  
  26. # Setup a safe Bash scripting environment
  27.  
  28. set -o errexit      # Exit immediately if an error occurs
  29. set -o noclobber    # Do not allow files to be overwritten via redirect
  30. set -o nounset      # Do not allow unset variables
  31.  
  32. # Set the exit code of a pipeline to the rightmost non-zero on error
  33. set -o pipefail
  34. #set -o xtrace       # Trace script execution (i.e., debug mode)
  35. # Set the internal field separator to newline or tab, but not space
  36. IFS=$'\n\t'
  37.  
  38. # Setup a secure Bash scripting environment by: setting a secure path;
  39. # clearing all aliases; clearing the command path hash; setting the hard limit
  40. # to 0 to turn off core dumps; and setting a secure umask
  41.  
  42. PATH=$(PATH='/bin:/usr/bin' getconf PATH); export PATH
  43. builtin unalias -a
  44. hash -r
  45. ulimit -H -c 0 --
  46.  
  47. UMASK=002
  48. umask ${UMASK}
  49.  
  50. EXCLUDES='--exclude-dir=.git --exclude-dir=.svn --exclude=*~ --exclude=*#*#'
  51. grep -HIPnrs --color=auto $EXCLUDES "$@"
  52.  
  53. # vim: set filetype=sh smartindent autoindent smarttab expandtab tabstop=4 softtabstop=4 shiftwidth=4 autoread
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement