List Info

Thread: Re: Fwd: Problem with redirecting cat command output to a file




Re: Fwd: Problem with redirecting cat command output to a file
country flaguser name
United States
2007-09-11 07:05:48
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Pratiksha Powar on 9/11/2007 12:14 AM:
> 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

Do you have spurious carriage returns (r) in your script
file?  Unix
shells treat it like any other file name character, even if
it doesn't
show up visually.  So it probably created the file 'srcr',
which ls then
displays as 'src?' with its default quoting options.  One
way to confirm
this would be using 'cat -A src*'.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at
home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


iD8DBQFG5oSc84KuGfSFAYARAhkEAJ47G4Th/PySvVWcHyH2FfjQaOJTWgCb
BP1P
P1n77EgdB5uadaQ2tXI7Ty0=
=uERn
-----END PGP SIGNATURE-----



Re: Fwd: Problem with redirecting cat command output to a file
user name
2007-09-18 01:04:34
Thank you all very much.
The problem has been solved.
It was the spurious carriage returns.
I'm now using the command : stty -igncr
asking bash to ignore the carriage returns.


On 9/11/07, Eric Blake <ebb9byu.net> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> According to Pratiksha Powar on 9/11/2007 12:14 AM:
> > 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
>
> Do you have spurious carriage returns (r) in your
script file?  Unix
> shells treat it like any other file name character,
even if it doesn't
> show up visually.  So it probably created the file
'srcr', which ls then
> displays as 'src?' with its default quoting options. 
One way to confirm
> this would be using 'cat -A src*'.
>
> - --
> Don't work too hard, make some time for fun as well!
>
> Eric Blake             ebb9byu.net
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (Cygwin)
> Comment: Public key at
home.comcast.net/~ericblake/eblake.gpg
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

>
>
iD8DBQFG5oSc84KuGfSFAYARAhkEAJ47G4Th/PySvVWcHyH2FfjQaOJTWgCb
BP1P
> P1n77EgdB5uadaQ2tXI7Ty0=
> =uERn
> -----END PGP SIGNATURE-----
>

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )