Skip to content

Instantly share code, notes, and snippets.

@jdimpson
Created July 5, 2025 17:13
Show Gist options
  • Save jdimpson/8078fbc60a93a08573fb285edbaa342e to your computer and use it in GitHub Desktop.
Save jdimpson/8078fbc60a93a08573fb285edbaa342e to your computer and use it in GitHub Desktop.
inspect and modify command line parameters in a bash wrapper script
#!/bin/bash
c=0;
args=( "$@" );
while test $c -lt ${#args[@]}; do
# inspect "${args[$c]}"
# assign to args[$c]
c=$(expr $c + 1);
done
set -- "${args[@]}";
# if you want to add new args:
# set -- "-u" "user" "-p" "pass" "${args[@]}";
# run original command with $*, e.g.
# exec yt-dlp "$*";
# and invoke this script with command line
# flags as if it were the original command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment