From: Jim Reimer <wa5rrh@arrl.net>
To: Paul Kraus <pkraus@pelsupply.com>
Cc: linux-newbie@vger.kernel.org
Subject: Re: Variable Quoting
Date: Mon, 14 Oct 2002 11:32:58 -0500 [thread overview]
Message-ID: <3DAAF1BA.1090205@arrl.net> (raw)
In-Reply-To: 004201c2739b$220b5b90$64fea8c0@pkrausxp
Paul Kraus wrote:
> I am having trouble quoting with variables.
>
> For example
>
> source="/backup/My\ Documents/*"
> cp ${source} /tmp
either protect with quotes -or- escape the space...
source="/backup/My Documents/*" (quotes, no escape)
or
source=/backup/My\ Documents/* (escape, no quotes)
don't do both.
>
> When I run this it will see everything up to my and bomb.
> Now if I type the exact same path in the exact same way into the code
>
> cp /backup/My\ Documents/*"
> It will work fine.
>
> This is not a real world example. I made this up for this email. I am
> having this kind of problems with many commands.
> Another better example would be...
>
> subj="This is a test email"
> mutt -s ${subj} someemailaddress < somemessage
protect the variable with quotes:
mutt -s "$subj" someemail.......
( by the way....
you don't have to surround the variable name with braces unless it's
right up against something else, as in
filename="test"
cp somefile ${test}.txt
if it's seperated by white space they don't have to be there
)
>
> When this is run This becomes the subject and the rest of $subj became
> email address. I have also tried escaping the spaces with \ and it does
> not work. But when entered directly into the command it works fine.
>
>
> Paul Kraus
> Network Administrator
> PEL Supply Company
> 216.267.5775 Voice
> 216-267-6176 Fax
> www.pelsupply.com
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
next prev parent reply other threads:[~2002-10-14 16:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-14 16:02 Variable Quoting Paul Kraus
2002-10-14 16:32 ` Jim Reimer [this message]
2002-10-14 16:38 ` Jim Reimer
2002-10-14 17:59 ` Paul Kraus
2002-10-14 20:54 ` Don Petrowski
[not found] <200210142055.11942.linux-newbie@jimmo.com>
2002-10-14 18:38 ` Paul Kraus
2002-10-14 19:58 ` James Mohr
2002-10-14 19:53 ` Paul Kraus
2002-10-15 16:13 ` Paul Furness
2002-10-16 7:23 ` ichi
2002-10-16 10:51 ` Paul Furness
2002-10-14 19:55 ` Paul Kraus
2002-10-14 21:00 ` James Mohr
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=3DAAF1BA.1090205@arrl.net \
--to=wa5rrh@arrl.net \
--cc=linux-newbie@vger.kernel.org \
--cc=pkraus@pelsupply.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox