Re: Issues with creating a shell script.
- From: Ed Morton <morton@xxxxxxxxxxxxxx>
- Date: Tue, 17 Oct 2006 09:51:42 -0500
cephalon wrote:
Ed Morton wrote:
Show us how you're calling your shell script both from the commandline
and from the other script you mention. If "logger" can take an argument
or stdin and your script is written as you originally described:
echo $1 > $$LOG
logger $1
then if you call your script as:
script "x"
you'll see "x" written to the file echo creates and to the one "logger"
uses, but if you call your script as:
echo "x" | script
then you'll see nothing written to the file "echo" uses and "x" written
to the file logger uses, which seems to be the symptom you're reporting.
The script is called from another process
From another process? Do you mean from another script or do you mean it's being run in the background?
in the form 'script X'.
You should post the code using copy and paste rather than trying to describe how you think it works. Post the smallest code sample with sample input and output that can reproduce the problem.
"X" is written to syslog, but the when looking at the file created by echo, it is empty.> It does however, show 1kb in size. X is a long block of
text, nearly identical to the text mentioned in above posts.
Fine, but is it being passed as:
script long block of text
or:
scrip "long block of text"
or something else? Again, show us the code.
The script has been tried in two fashions -- first, with the echo $1,
In case no-ones mentioned it already, you should always quote your variables unless you know exactly what you're doing and have a very good reason not to, so you really want that to be echo "$1" rather than echo $1. I used the latter form because that's what you used and it does affect the behavior.
as mentioned above, second using printf, as was recommended by later posts
in this thread. Both create the similar output.
Regards,
Ed.
.
- References:
- Issues with creating a shell script.
- From: cephalon
- Re: Issues with creating a shell script.
- From: Chris Mattern
- Re: Issues with creating a shell script.
- From: cephalon
- Re: Issues with creating a shell script.
- From: Chris F.A. Johnson
- Re: Issues with creating a shell script.
- From: cephalon
- Re: Issues with creating a shell script.
- From: Chris Mattern
- Re: Issues with creating a shell script.
- From: cephalon
- Re: Issues with creating a shell script.
- From: cephalon
- Re: Issues with creating a shell script.
- From: Ed Morton
- Re: Issues with creating a shell script.
- From: cephalon
- Issues with creating a shell script.
- Prev by Date: Getting recods that are greater than 2500 bytes in a file
- Next by Date: Re: Getting recods that are greater than 2500 bytes in a file
- Previous by thread: Re: Issues with creating a shell script.
- Next by thread: Re: Issues with creating a shell script.
- Index(es):
Relevant Pages
|