File: fckit-eval.sh

package info (click to toggle)
fckit 0.14.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,528 kB
  • sloc: f90: 7,650; python: 5,805; cpp: 2,202; pascal: 805; sh: 656; makefile: 66
file content (25 lines) | stat: -rwxr-xr-x 580 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env bash
set -e

if [[ ${FCKIT_EVAL_ARGS_EXCLUDE:-unset} != unset ]]; then
  excludes=()
  IFS=${FCKIT_EVAL_ARGS_EXCLUDE_DELIMITER:-,} read -r -a excludes <<< "$FCKIT_EVAL_ARGS_EXCLUDE"
  args=("$@")
  for ((i=0; i<"${#args[@]}"; ++i)); do
    for exclude in "${excludes[@]}"; do
      if [[ "${args[i]}" =~ ${exclude} ]]; then
        unset args[i];
      fi
    done
  done
  if [[ ${FCKIT_EVAL_VERBOSE:-unset} == 1 ]]; then
    echo "+ ${args[@]}"
  fi
  eval "${args[@]}"
else
  if [[ ${FCKIT_EVAL_VERBOSE:-unset} == 1 ]]; then
    echo "+ $@"
  fi
  eval "$@"
fi