Unix Programming - echo

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > September 2005 > echo





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author echo
James

2005-09-21, 7:49 am

echo "$foo $abc" > $FILE

Why doest this write to the screen and not to file and how could I fix it


Nils O. Selåsdal

2005-09-21, 7:49 am

James wrote:
> echo "$foo $abc" > $FILE
>
> Why doest this write to the screen and not to file and how could I fix it

It does here.
Tell us a bit about which OS and shell you are using,
along with what you put in your FILE,foo and abc variables.
James

2005-09-21, 7:49 am

bourne
foo is full filename ie /ect/passwd
abc is a number
os is SunOS
"Nils O. Selåsdal" <NOS@Utel.no> wrote in message
news:433134cc$1@news.broadpark.no...
> James wrote:
it[vbcol=seagreen]
> It does here.
> Tell us a bit about which OS and shell you are using,
> along with what you put in your FILE,foo and abc variables.



#2pencil

2005-09-21, 5:54 pm

What does it return if you don't use the variables & use real data?

-#2pencil-

Eric Enright

2005-09-21, 5:54 pm

James wrote:
> bourne
> foo is full filename ie /ect/passwd
> abc is a number
> os is SunOS


eric@lw:~ (1)> exec /bin/sh
$ foo="/etc/passwd"
$ abc="10"
$ FILE="/home/eric/bar"
$ echo "$foo $abc" > $FILE
$ cat /home/eric/bar
/etc/passwd 10
$ uname -a
SunOS lw 5.11 snv_18 i86pc i386 i86pc

Works fine here. Could you post the exact commands/variables
you are trying?

Eric

> "Nils O. Selåsdal" <NOS@Utel.no> wrote in message
> news:433134cc$1@news.broadpark.no...
> it
>
>

Chuck Dillon

2005-09-22, 9:01 pm

James wrote:
> echo "$foo $abc" > $FILE
>
> Why doest this write to the screen and not to file and how could I fix it
>
>


What's in $FILE? Perhaps it needs to be quoted. Also what does "which
echo" say? Anything unexpected?

-- ced

--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com