title: File name too long error creating a json file in bash
body: <p>I am trying to create a json file with a bash script I created. The script creates the file, but the file is empty. </p>
  
  <p>When it runs, I get this error: <code>File name too long</code></p>
  
  <p>And the file has no contents, it's completely empty:</p>
  
  <pre><code>-rw-r--r-- 1 tdunphy tdunphy 0 Jan 25 09:45 pol-aws-secrets-manager-aws-test-user-one.json
  </code></pre>
  
  <p>I suspect that the file name is not the problem. I think that the contents of the file may be too long. Is there a limit on how much you can echo into a text file using bash?</p>
  
  <p>Here is my script:</p>
  
  <pre><code>#!/bin/bash
  aws_user_name=tim
  aws_kms_key_arn=arn
  create_secrets_manager_policy() {
  
  output_dir="../json/iam"
  ofile="$output_dir"/pol-aws-secrets-manager-"$aws_user_name".json
  
  #### BEGIN JSON
   echo
    "{
      \"Version\": \"2012-10-17\",
      \"Statement\": [{
          \"Effect\": \"Allow\",
          \"Action\": [
            \"secretsmanager:ListSecrets\",
            \"secretsmanager:GetRandomPassword\"
          ],
          \"Resource\": \"*\"
        },
        {
          \"Effect\": \"Allow\",
          \"Action\": [
            \"kms:Decrypt\"
          ],
          \"Resource\": \"$aws_kms_key_arn\"
        },
        {
          \"Effect\": \"Allow\",
          \"Action\": [
            \"kms:List*\"
          ],
          \"Resource\": \"*\"
        },
        {
          \"Effect\": \"Allow\",
          \"Action\": [
            \"secretsmanager:GetResourcePolicy\",
            \"secretsmanager:GetSecretValue\",
            \"secretsmanager:DescribeSecret\",
            \"secretsmanager:ListSecretVersionIds\"
          ],
          \"Resource\": \"*\",
          \"Condition\": {
            \"ForAnyValue:StringEquals\": {
              \"secretsmanager:ResourceTag/Name\": \"$aws_user_name\"
            }
          }
        }
      ]
    }"  &gt; "$ofile"
  
    ######## END JSON     
  
  }
  </code></pre>