Skip to content

Instantly share code, notes, and snippets.

@zfenj
Created February 9, 2019 16:41
Show Gist options
  • Save zfenj/305ec0b0ee88a0a668228b91998f6d6f to your computer and use it in GitHub Desktop.
Save zfenj/305ec0b0ee88a0a668228b91998f6d6f to your computer and use it in GitHub Desktop.
Bash: How to output command to next prompt for user to use?
Source: https://superuser.com/a/1130773
MY_COMMAND="ls"
MY_PARAMS=()
read -a MY_PARAMS -p $MY_COMMAND
exec $MY_COMMAND ${MY_PARAMS[@]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment