How to properly nest Bash backticks

Use $(commands) instead: $ echo “hello1-$(echo hello2-$(echo hello3-$(echo hello4)))” hello1-hello2-hello3-hello4 $(commands) does the same thing as backticks, but you can nest them. You may also be interested in Bash range expansions: echo hello{1..10} hello1 hello2 hello3 hello4 hello5 hello6 hello7 hello8 hello9 hello10

Build a JSON string with Bash variables

You are better off using a program like jq to generate the JSON, if you don’t know ahead of time if the contents of the variables are properly escaped for inclusion in JSON. Otherwise, you will just end up with invalid JSON for your trouble. BUCKET_NAME=testbucket OBJECT_NAME=testworkflow-2.0.1.jar TARGET_LOCATION=/opt/test/testworkflow-2.0.1.jar JSON_STRING=$( jq -n \ –arg bn “$BUCKET_NAME” … Read more

How to escape single quotes within single quoted strings

If you really want to use single quotes in the outermost layer, remember that you can glue both kinds of quotation. Example: alias rxvt=”urxvt -fg “”‘”‘#111111′”‘”‘ -bg ‘”‘”‘#111111′”‘” # ^^^^^ ^^^^^ ^^^^^ ^^^^ # 12345 12345 12345 1234 Explanation of how ‘”‘”‘ is interpreted as just ‘: ‘ End first quotation which uses single quotes. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)