Skip to content

Instantly share code, notes, and snippets.

@navono
Created June 12, 2019 00:28
Show Gist options
  • Select an option

  • Save navono/dcf4fe68eb33497e8b7dcb8d28139ca4 to your computer and use it in GitHub Desktop.

Select an option

Save navono/dcf4fe68eb33497e8b7dcb8d28139ca4 to your computer and use it in GitHub Desktop.
add prefix string in list
MYLIST=(var1 var2 var3)
echo ${MYLIST[@]/#/my_}
# Output: my_var1 my_var2 my_var3
DATABASE="database1"
IGNORE_TABLES=(table1 table2 table3)
echo mysqldump ${IGNORE_TABLES[@]/#/--ignore-table=${DATABASE}.} ${DATABASE}
# Output: mysqldump --ignore-table=database1.table1 --ignore-table=database1.table2 --ignore-table=database1.table3 database1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment