delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/07/11/03:48:02

From: morche AT sat1 DOT de (Matthias Morche)
Subject: Re: How to echo a string of more than 1024 chars in a bash script?
11 Jul 1998 03:48:02 -0700 :
Message-ID: <35A608CA.6833B84.cygnus.gnu-win32@sat1.de>
References: <35A559FA DOT F543C1D2 AT iconz DOT co DOT nz>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com
Cc: Kim Ollivier <kimo AT iconz DOT co DOT nz>

Kim Ollivier schrieb:
> 
> I have a script that generates a header and standard script that now
> fails
> if I run it under NT4.0 and B19 Cynus bash shell. I think it used to
> work,
> but it certainly does in Solaris.
> eg
> # make a dummy script
> ... various variables and setup options
> ... dates etc
> echo "
> # comments
> Date: $DATE
> commands
> lots more lines.... more than 1024 chars in total
> " > scriptname
> 
> The resulting scriptname file is truncated. Sometimes bash core dumps.
> 
> Is this a bash limit, an environment setting, an echo command limit, or
> what.
> If it is a built-in limit, what simple shell scripting techniques get
> around it?
....
That is bad style! Try to use cat and a here-document instead:
cat << EOF > scriptname
# comments
DATE : $DATE
commands
....
EOF

I guess Your Environment Space is not large enough for such a long
command line - The command line and the environment variables use the
same space.
-- 
	Matthias Morche (mailto:morche AT sat1 DOT de)
		SAT.1 (http://www.sat1.de)

>>> Linux: the greatest adventure game since the invention of the PC <<<
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019