You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

8 lines
281 B

  1. #!/bin/bash
  2. # Usage: nicegrep NICE MAXMEMORY ARG...
  3. # Executes grep with the provided arguments using `nice -n NICE` and `ulimit -v MAXMEMORY`
  4. nice="$1"; shift
  5. maxMemory="$1"; shift
  6. if [[ "${maxMemory}" != '0' ]]; then ulimit -v "${maxMemory}"; fi
  7. exec nice -n "${nice}" grep "$@"