bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with redirecting cat command output to a file


From: Mike Frysinger
Subject: Re: Problem with redirecting cat command output to a file
Date: Tue, 11 Sep 2007 03:13:59 -0400
User-agent: KMail/1.9.7

On Tuesday 11 September 2007, Pratiksha Powar wrote:

this sounds like shell problems, not cat problems

if you still have problems, you should enable shell debugging (set -x) to 
track things down ... if you're still unable to solve your troubles, i'd 
suggest a general Linux/shell forum rather than the coreutils mailing list

> Problem 1:
> --------
> Following is the code (in a shell script)which redirects find command
> output to a file called "src". But this command generates a file called
> "src?" instead.
>
> SOURCE_PATH="src"
> rm -f $SOURCE_PATH
> #Getting all OPS src files
> find ../../com/onmobile/noc/common -name *.java > src

you probably need to quote *.java to keep the shell from expanding it

> Problem 2:
> ---------
> Later I need to read the src file.
> To circumvent Problem 1, if I use the below code :
>
> SOURCE="$SOURCE_PATH?"
> $JAVA_HOME/bin/javac -classpath $CLASSPATH -d $OUTPUT_PATH -sourcepath <
> cat $SOURCE
>
> I receive following error:
> cat: No such file or directory

that is not how input redirection works ... i dont know whether you're trying 
to feed the file "$SOURCE" into javac or pass the list of things in as an 
argument ... the former, just drop the "cat":
.../javac ... < $SOURCE
for the latter, inline it properly:
.../javac ... $(cat $SOURCE)
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]