zsh-users
 help / color / mirror / code / Atom feed
* Adding arbitrary data at the end of a script
@ 2005-02-17  9:12 DervishD
  2005-02-17  9:36 ` Wayne Davison
  0 siblings, 1 reply; 3+ messages in thread
From: DervishD @ 2005-02-17  9:12 UTC (permalink / raw)
  To: Zsh Users

    Hi all :)

    I'm doing a self-contained script that needs some data to work.
This data is going to be added at the end of script (after the 'exit
0' command that terminates the script), but zsh reads *and tries to
expand* the entire bunch of data. I haven't found in SUS anything
that forbids or allows this behaviour, and I'm confused.

    The script is functionally like this:

#!/bin/zsh
true
exit 0
<Text data that contains some '$', backticks, etc.>

    I've tried this, too:

#!/bin/zsh
true
exit 0
cat << DATA.EOF > /dev/null
<Text data that contains some '$', backticks, etc.>
DATA.EOF

    Obviously, I can quote, by hand, all things that makes the shell
barf (not only Zsh, Bash suffer from this too), but I would like to
avoid it because it will be very time consuming and error prone. In
fact, the 'bunch of data' is no more than a shell script skeleton
that will be processed through sed. The main script uses something
like this:

cat 0 | sed...

    to process itself and the bunch of data and generate another
script.

    If I cannot avoid the data to be read by the shell, how can I
avoid expansion portably? The script must be self-contained, and the
data must go inside of it. I've thought of a solution but it's not
very good for me and I would like to avoid it: ASCII armoring the
'data' (removing the shell metachars in the process) and dearmoring
it on the fly while processing through sed...

    Thanks in advance :)

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736
http://www.dervishd.net & http://www.pleyades.net/
It's my PC and I'll cry if I want to...


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-02-17 11:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-17  9:12 Adding arbitrary data at the end of a script DervishD
2005-02-17  9:36 ` Wayne Davison
2005-02-17 11:23   ` DervishD

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).