Skip to content

Instantly share code, notes, and snippets.

@jaymecd
Created February 13, 2014 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaymecd/8976571 to your computer and use it in GitHub Desktop.
Save jaymecd/8976571 to your computer and use it in GitHub Desktop.
Remove bash argument
#!/usr/bin/env bash
#
# Remove any argument matching --env= and prepend --env=test
#
args=("$@")
idx=0
for arg in "${args[@]}"; do
if echo "$arg" | grep -i "^\-\-env=" >/dev/null; then
unset args[$idx]
fi
let idx++
done
args=("--env=test" "${args[@]}")
other_app_to_call "${args[@]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment