[clue-talk] Bash scripting question
G. Richard Raab
clue at raab.windbournetech.com
Wed Nov 30 09:35:24 MST 2005
On Wednesday 30 November 2005 09:13, Sean LeBlanc wrote:
> ssmtp -f me at me.com me at me.com me2 at me.com < msg
>
> Here's where I run into the problem: Can any bash/sh gurus tell me how I
> can I construct the message without writing to external file? The stream of
> msg needs to look like this:
>
> Subject: $1
> $1
Next to google, you will find the man pages the most important things going.
<MAN>
Here Documents
This type of redirection instructs the shell to read input from the
current source until a line containing only word (with no trailing blanks) is
seen. All of the lines read up to
that point are then used as the standard input for a command.
The format of here-documents is:
<<[-]word
here-document
delimiter
No parameter expansion, command substitution, arithmetic expansion, or
pathname expansion is performed on word. If any characters in word are
quoted, the delimiter is the result of
quote removal on word, and the lines in the here-document are not
expanded. If word is unquoted, all lines of the here-document are subjected
to parameter expansion, command substi‐
tution, and arithmetic expansion. In the latter case, the character
sequence \<newline> is ignored, and \ must be used to quote the characters \,
$, and `.
If the redirection operator is <<-, then all leading tab characters are
stripped from input lines and the line containing delimiter. This allows
here-documents within shell scripts
to be indented in a natural fashion.
</MAN>
--
cheers
g.r.r.
More information about the clue-talk
mailing list