zsh-users
 help / color / mirror / code / Atom feed
From: DervishD <zsh@dervishd.net>
To: Zsh Users <zsh-users@sunsite.dk>
Subject: Adding arbitrary data at the end of a script
Date: Thu, 17 Feb 2005 10:12:56 +0100	[thread overview]
Message-ID: <20050217091256.GA941@DervishD> (raw)

    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...


             reply	other threads:[~2005-02-17  9:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-17  9:12 DervishD [this message]
2005-02-17  9:36 ` Wayne Davison
2005-02-17 11:23   ` DervishD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050217091256.GA941@DervishD \
    --to=zsh@dervishd.net \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).