I have a file that I'm trying to place into a variable.
I've tried the following:
DATE=`date +%Y%m%d`
filez=$(cat /tmp/Test_$DATE.txt)
DATE=`date +%Y%m%d`
filez=$(</tmp/Test_$DATE.txt)
DATE=`date +%Y%m%d`
filez=$(`cat /tmp/Test_$DATE.txt`)
None of these lines allows the file to go into the variable, unless the file is small. If it is a small file, then it works. If it is a large file, I get the following error:
builds/ul11u3sru-gate/components/bash/bash-4.4/lib/sh/strtrans.c:66: cannot allocate 1448426861 bytes (3758187128 bytes allocated)
./scripttest.bash: xmalloc: /builds/ul11u3sru-gate/components/bash/bash-4.4/lib/sh/strtrans.c:66: cannot allocate 1448426861 bytes (3758187128 bytes allocated)
./scripttest.bash: xmalloc: /builds/ul11u3sru-gate/components/bash/bash-4.4/lib/sh/strtrans.c:66: cannot allocate 1448426861 bytes (3758187128 bytes allocated)
Anyone know how to fix this? Apparently the file size causes it.