Skip to main content
Correct error in the explanation
Source Link
AdminBee
  • 23.6k
  • 25
  • 56
  • 77

The problem is that you are using the old-style "backticks"-notation for the command substitution. Their use is discouraged, among other reasons because they cannot be nested easily.

The error messages you receive can be understood if you consider that your command-substitution only spans your command up to the opening backtick of your query condition, i.e. only the part

aws rds describe-db-cluster-snapshots --db-cluster-identifier creditpoc3 --query 'DBClusterSnapshots[].{DBClusterSnapshotIdentifier:DBClusterSnapshotIdentifier,Status:Status} | [?DBClusterSnapshotIdentifier == 

The shell then tries to concatenate the variable snap_count from

  • the result of that command invocation - which the shell can't parse because you have an unbalanced opening single-quote (this is the reason for the first of your two error messages)
  • the interpretation of '"$snap_name"' which results in the literal string "$snap_name" because from the point-of-view of the shell, it is placed in single-quotes, and then
  • another command-substution started by what you inteded as closing backtick of your query condition. This would be the output of the command ']'' | grep creating which again has unbalanced single-quotes and is the reason for the second of your two error messages.

The result, as noted by @ilkkachu, is that $snap_count is assigned the only valid part of the assigment, which is the literal string "$snap_name".

Use the recommended $( ... )-notation for the actual command-substitution instead (i.e. instead of the outer backticks), this will not lead to conflict with the ` ... ` that you presumably require for the query syntax in the ?DBClusterSnapshotIdentifier condition.

The problem is that you are using the old-style "backticks"-notation for the command substitution. Their use is discouraged, among other reasons because they cannot be nested easily.

The error messages you receive can be understood if you consider that your command-substitution only spans your command up to the opening backtick of your query condition, i.e. only the part

aws rds describe-db-cluster-snapshots --db-cluster-identifier creditpoc3 --query 'DBClusterSnapshots[].{DBClusterSnapshotIdentifier:DBClusterSnapshotIdentifier,Status:Status} | [?DBClusterSnapshotIdentifier == 

The shell then tries to concatenate the variable snap_count from

  • the result of that command invocation - which the shell can't parse because you have an unbalanced opening single-quote (this is the reason for the first of your two error messages)
  • the interpretation of '"$snap_name"' which results in the literal string "$snap_name" because from the point-of-view of the shell, it is placed in single-quotes, and then
  • another command-substution started by what you inteded as closing backtick of your query condition. This would be the output of the command ']'' | grep creating which again has unbalanced single-quotes and is the reason for the second of your two error messages.

Use the recommended $( ... )-notation for the actual command-substitution instead (i.e. instead of the outer backticks), this will not lead to conflict with the ` ... ` that you presumably require for the query syntax in the ?DBClusterSnapshotIdentifier condition.

The problem is that you are using the old-style "backticks"-notation for the command substitution. Their use is discouraged, among other reasons because they cannot be nested easily.

The error messages you receive can be understood if you consider that your command-substitution only spans your command up to the opening backtick of your query condition, i.e. only the part

aws rds describe-db-cluster-snapshots --db-cluster-identifier creditpoc3 --query 'DBClusterSnapshots[].{DBClusterSnapshotIdentifier:DBClusterSnapshotIdentifier,Status:Status} | [?DBClusterSnapshotIdentifier == 

The shell then tries to concatenate the variable snap_count from

  • the result of that command invocation - which the shell can't parse because you have an unbalanced opening single-quote (this is the reason for the first of your two error messages)
  • the interpretation of '"$snap_name"' which results in the literal string "$snap_name" because from the point-of-view of the shell, it is placed in single-quotes, and then
  • another command-substution started by what you inteded as closing backtick of your query condition. This would be the output of the command ']'' | grep creating which again has unbalanced single-quotes and is the reason for the second of your two error messages.

The result, as noted by @ilkkachu, is that $snap_count is assigned the only valid part of the assigment, which is the literal string "$snap_name".

Use the recommended $( ... )-notation for the actual command-substitution instead (i.e. instead of the outer backticks), this will not lead to conflict with the ` ... ` that you presumably require for the query syntax in the ?DBClusterSnapshotIdentifier condition.

Correct error in the explanation
Source Link
AdminBee
  • 23.6k
  • 25
  • 56
  • 77

The problem is that you are using the old-style "backticks"-notation for the command substitution. Their use is discouraged, among other reasons because they cannot be nested easily.

The error messagemessages you receive can be understood if you consider that your command-substitution only spans your command up to the opening backtick of your query condition, i.e. only the part

aws rds describe-db-cluster-snapshots --db-cluster-identifier creditpoc3 --query 'DBClusterSnapshots[].{DBClusterSnapshotIdentifier:DBClusterSnapshotIdentifier,Status:Status} | [?DBClusterSnapshotIdentifier == 

The shell then tries to concatenate the variable snap_count from

  • the result of that command invocation (which would fail due to syntax reasons if- which the shell came that farcan't parse because you have an unbalanced opening single-quote (this is the reason for the first of your two error messages)
  • the interpretation of '"$snap_name"' which results in the literal string "$snap_name" because from the point-of-view of the shell, it is placed in single-quotes, and then
  • another command-substution started by what you inteded as closing backtick of your query condition. This would be the output of the command ']'' | grep creating which again has unbalanced single-quotes, so and is the shell already stops here because it can't even parse itreason for the second of your two error messages.

Use the recommended $( ... )-notation for the actual command-substitution instead (i.e. instead of the outer backticks), this will not lead to conflict with the ` ... ` that you presumably require for the query syntax in the ?DBClusterSnapshotIdentifier condition.

The problem is that you are using the old-style "backticks"-notation for the command substitution. Their use is discouraged, among other reasons because they cannot be nested easily.

The error message you receive can be understood if you consider that your command-substitution only spans your command up to the opening backtick of your query condition, i.e. only the part

aws rds describe-db-cluster-snapshots --db-cluster-identifier creditpoc3 --query 'DBClusterSnapshots[].{DBClusterSnapshotIdentifier:DBClusterSnapshotIdentifier,Status:Status} | [?DBClusterSnapshotIdentifier == 

The shell then tries to concatenate the variable snap_count from

  • the result of that command invocation (which would fail due to syntax reasons if the shell came that far)
  • the interpretation of '"$snap_name"' which results in the literal string "$snap_name" because from the point-of-view of the shell, it is placed in single-quotes, and then
  • another command-substution started by what you inteded as closing backtick of your query condition. This would be the output of the command ']'' | grep creating which has unbalanced single-quotes, so the shell already stops here because it can't even parse it.

Use the recommended $( ... )-notation for the actual command-substitution instead (i.e. instead of the outer backticks), this will not lead to conflict with the ` ... ` that you presumably require for the query syntax in the ?DBClusterSnapshotIdentifier condition.

The problem is that you are using the old-style "backticks"-notation for the command substitution. Their use is discouraged, among other reasons because they cannot be nested easily.

The error messages you receive can be understood if you consider that your command-substitution only spans your command up to the opening backtick of your query condition, i.e. only the part

aws rds describe-db-cluster-snapshots --db-cluster-identifier creditpoc3 --query 'DBClusterSnapshots[].{DBClusterSnapshotIdentifier:DBClusterSnapshotIdentifier,Status:Status} | [?DBClusterSnapshotIdentifier == 

The shell then tries to concatenate the variable snap_count from

  • the result of that command invocation - which the shell can't parse because you have an unbalanced opening single-quote (this is the reason for the first of your two error messages)
  • the interpretation of '"$snap_name"' which results in the literal string "$snap_name" because from the point-of-view of the shell, it is placed in single-quotes, and then
  • another command-substution started by what you inteded as closing backtick of your query condition. This would be the output of the command ']'' | grep creating which again has unbalanced single-quotes and is the reason for the second of your two error messages.

Use the recommended $( ... )-notation for the actual command-substitution instead (i.e. instead of the outer backticks), this will not lead to conflict with the ` ... ` that you presumably require for the query syntax in the ?DBClusterSnapshotIdentifier condition.

Add more explanation
Source Link
AdminBee
  • 23.6k
  • 25
  • 56
  • 77

The problem is that you are using the old-style "backticks"-notation for the command substitution. Their use is discouraged, among other reasons because they cannot be nested easily.

The error message you receive can be understood if you consider that your command-substitution only spans your command up to the opening backtick of your query condition, i.e. only the part

aws rds describe-db-cluster-snapshots --db-cluster-identifier creditpoc3 --query 'DBClusterSnapshots[].{DBClusterSnapshotIdentifier:DBClusterSnapshotIdentifier,Status:Status} | [?DBClusterSnapshotIdentifier == 

The shell then tries to concatenate the variable assignmentsnap_count from

  • the result of that command invocation (which would fail due to syntax reasons if the shell came that far)
  • the interpretation of '"$snap_name"' which results in the literal string "$snap_name" because from the point-of-view of the shell, it is placed in single-quotes, and then
  • another command-substution started by what you inteded as closing backtick of your query condition. This would be the output of the command ']'' | grep creating which has unbalanced single-quotes, so the shell already stops here because it can't even parse it.

Use the recommended $( ... )-notation for the actual command-substitution instead (i.e. instead of the outer backticks), this will not lead to conflict with the ` ... ` that you presumably require for the query syntax in the ?DBClusterSnapshotIdentifier condition.

The problem is that you are using the old-style "backticks"-notation for the command substitution. Their use is discouraged, among other reasons because they cannot be nested easily.

The error message you receive can be understood if you consider that your command-substitution only spans

aws rds describe-db-cluster-snapshots --db-cluster-identifier creditpoc3 --query 'DBClusterSnapshots[].{DBClusterSnapshotIdentifier:DBClusterSnapshotIdentifier,Status:Status} | [?DBClusterSnapshotIdentifier == 

The shell then tries to concatenate the variable assignment from

  • the result of that command invocation (which would fail)
  • the interpretation of '"$snap_name"' which results in the literal string "$snap_name" because from the point-of-view of the shell, it is placed in single-quotes, and then
  • the output of the command ']'' | grep creating which has unbalanced single-quotes.

Use the recommended $( ... )-notation for the actual command-substitution instead (i.e. instead of the outer backticks), this will not lead to conflict with the ` ... ` that you presumably require for the query syntax in the ?DBClusterSnapshotIdentifier condition.

The problem is that you are using the old-style "backticks"-notation for the command substitution. Their use is discouraged, among other reasons because they cannot be nested easily.

The error message you receive can be understood if you consider that your command-substitution only spans your command up to the opening backtick of your query condition, i.e. only the part

aws rds describe-db-cluster-snapshots --db-cluster-identifier creditpoc3 --query 'DBClusterSnapshots[].{DBClusterSnapshotIdentifier:DBClusterSnapshotIdentifier,Status:Status} | [?DBClusterSnapshotIdentifier == 

The shell then tries to concatenate the variable snap_count from

  • the result of that command invocation (which would fail due to syntax reasons if the shell came that far)
  • the interpretation of '"$snap_name"' which results in the literal string "$snap_name" because from the point-of-view of the shell, it is placed in single-quotes, and then
  • another command-substution started by what you inteded as closing backtick of your query condition. This would be the output of the command ']'' | grep creating which has unbalanced single-quotes, so the shell already stops here because it can't even parse it.

Use the recommended $( ... )-notation for the actual command-substitution instead (i.e. instead of the outer backticks), this will not lead to conflict with the ` ... ` that you presumably require for the query syntax in the ?DBClusterSnapshotIdentifier condition.

pedantic correction
Source Link
terdon
  • 252.7k
  • 69
  • 481
  • 719
Loading
Add explanation
Source Link
AdminBee
  • 23.6k
  • 25
  • 56
  • 77
Loading
Source Link
AdminBee
  • 23.6k
  • 25
  • 56
  • 77
Loading