# Nested elements and other complex cases # String with backtick inclusion "x`ls`" # Nested string "x`ls "*.c"`" # Not terminated at first " "x`ls" # "`" # # String with command inclusion "x$(ls)" # Nested command $(ls -la$(ls *.c)) # Check strings and backticks in command echo $('ls' "." `ls` $'.' $".") # $( not terminated by ) if contains unterminated string $('x) # ') # $("x) # ") # $(`x) # `) # Bash doesn't like this $($'x) # ') # $($"x) # ") # # Parameter expansion var=abcdef sub=abc rep='& ' echo ${var/$sub/"${rep}}"} # # '$' in variable echo $$PID echo $var${var} # Here-doc with internal elements cat <