arrays - BASH regex matching in if statement -


I would like to mention now that I am not overwhelmed with either RegEx or BASH, so a debrief explanation would be very appreciated. This way I can learn thanks.

I have given this file a lot below, but basically what I want to do is take an array $ sqldatabases and see which variables have the @ symbol , Then check that specific variable to not include the @ sign, and finally run a mysqldump for that database; the code that I have happened with is currently If statement is lacking filtering forum @ I ([Sqlcount = 0; sqlcount & lt; $ {# sqldatab For ases [@]}; sqlcount ++)

  source config.sh sqldatabases = (bounty forum @ user donor) $ Sqldatabases [sqlcount] "= ~ * [@] *]] ; "Sqldatabases [sqlcount] = $ {sqldatabases [sqlcount] Sqlcount]} & gt; .backups / $ timedate / MySQL / $ {sqldatabases [sqlcount]} SQL   

Thank you again for your help, and try to explain every modification in depth.

You have to use the $ {array [index]} syntax. And you do not need to match the * s to @ (or use . * @. * instead):

  if [["$ {sqldatabases [sqlcount]}" = ~ @]]; Then sqldatabases [sqlcount] = $ {sqldatabases [sqlcount] // [@] "$ {sqldatabases [sqlcount}}" mysqldump # ... file    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -