I'm trying to do
echo "foo foo foo ....[many many lines of foo here] foo" > "/Users/myname/destination.txt"
through Applescript, but it returns an error when the characters in the lines of foo hit some amount (It looks like it's 255392 characters.).
By "through Applescript," I mean I'm trying this with AppleScript's "do shell script", which stops process when the exit status is non-zero and returns this:
"error "The command exited with a non-zero status." number 255
Here's my Applescript code:
set mytext to "foo foo foo ....[many many lines of foo here] foo" do shell script ("echo " & quoted form of mytext & " > " & "/Users/myname/destination.txt")
The actual big text data (20000+ lines, 285831 characters) I use for input has a lot of quotation marks and backslashes, and I don't want to mess up my files by put my text data directly into terminal and have it misinterpret some parts of my input text data as commands or file names, so I'm not checking this directly with bash yet.
It might be more of an Applescript's problem, but I thought I might get response sooner here, so I'm posting this here.
Is there a limit of characters of input text in echo, or something? How can I avoid this?
Edit: I wrote this in a shell script and ran it on terminal and it worked but I'd like to do this through Applescript and I don't have no idea why doesn't this work in Applescript :
#!/bin/bash echo "aaaaaaa[100000+ "a"s in here]aaaa" > "/Users/myname/destination.txt"