Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - fesh,esh output redirection problem: (9 Items)
   
fesh,esh output redirection problem  
Hello all,

"eecho Teststring >testfile" results in an empty file and the output string is printed to the console.

All (f)esh buildin commands seems to behave like this.
If you start a normal process from the embedded shell, redirection works as expected.

Is this a bug or a feature?

-Michael


Re: fesh,esh output redirection problem  
See http://www.qnx.com/developers/docs/6.4.1/neutrino/utilities/f/fesh.html#eecho

It is a feature. Use regular echo if you want the other behavior.

Michael Tasche <community-noreply@qnx.com> wrote:

Hello all,

"eecho Teststring >testfile" results in an empty file and the output string is printed to the console.

All (f)esh buildin commands seems to behave like this.
If you start a normal process from the embedded shell, redirection works as expected.

Is this a bug or a feature?

-Michael






_______________________________________________

OSTech
http://community.qnx.com/sf/go/post69139
Re: fesh,esh output redirection problem  
> See http://www.qnx.com/developers/docs/6.4.1/neutrino/utilities/f/fesh.html#
> eecho
> 
> It is a feature. Use regular echo if you want the other behavior.

Well, I am fighting against a very small nor flash.

Other example: 
# alias walter=uwe
# alias >testfile
walter=uwe

=> Output goes to console.
=> The file "testfile" is created, but empty.
For what we need this feature?
Perhaps you can explain that.

BTW:The "alias" example works as expected with the kornshell.

-Michael
Re: fesh,esh output redirection problem  
 Currently neither esh/fesh support redirection for print/eecho or the
alias command.

Prior to performing file globbing if the command parser detects either
the '>' or '<' redirection symbols in the command line it either creates
an empty file for writing or attempts to open one to read from. This
explains the behavior you have observed so far.

While I know this doesn't quite answer your question as to why things
are like this but if we keep in mind that redirection is not supported
for those commands then adding redirection symbols in the command line
can be classified as unspecified behavior. Redirection support can be
added to those commands with relative ease though.

The Korn shell is a different shell and also was not designed with the
same requirements as either esh/fesh so not valid for the comparison.

On 09/30/10 10:49, Michael Tasche wrote:
>> See http://www.qnx.com/developers/docs/6.4.1/neutrino/utilities/f/fesh.html#
>> eecho
>>
>> It is a feature. Use regular echo if you want the other behavior.
> Well, I am fighting against a very small nor flash.
>
> Other example: 
> # alias walter=uwe
> # alias >testfile
> walter=uwe
>
> => Output goes to console.
> => The file "testfile" is created, but empty.
> For what we need this feature?
> Perhaps you can explain that.
>
> BTW:The "alias" example works as expected with the kornshell.
>
> -Michael
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post69180
>
Re: fesh,esh output redirection problem  
> 
>  Currently neither esh/fesh support redirection for print/eecho or the
> alias command.
> 
> Prior to performing file globbing if the command parser detects either
> the '>' or '<' redirection symbols in the command line it either creates
> an empty file for writing or attempts to open one to read from. This
> explains the behavior you have observed so far.
> 
> While I know this doesn't quite answer your question as to why things
> are like this but if we keep in mind that redirection is not supported
> for those commands then adding redirection symbols in the command line
> can be classified as unspecified behavior. Redirection support can be
> added to those commands with relative ease though.

Yes, I agree after looking at the esh source.
At the moment the "redirection feature for buildin commands" is not mission critical for my project, but I think this 
feature would be very senseful for the embedded shell.

What do you think?
Re: fesh,esh output redirection problem  
You are certainly free to add redirection support as the source code is available. I provide a rough diff that adds 
support to most commands - you are free to use this but remember this is not a supported customization.
Attachment: Text esh.diff 3.24 KB
RE: fesh,esh output redirection problem  
esh redirection works correctly for me in 6.5.0 M9: 

#esh
#echo "this is good" >good.txt 
#cat good.txt
this is good



>"eecho

I'm assuming you meant to write "echo" with one e.

-ad


-----Original Message-----
From: Michael Tasche [mailto:community-noreply@qnx.com]
Sent: Thu 2010-09-30 08:14
To: ostech-core_os
Subject: fesh,esh output redirection problem
 
Hello all,

"eecho Teststring >testfile" results in an empty file and the output string is printed to the console.

All (f)esh buildin commands seems to behave like this.
If you start a normal process from the embedded shell, redirection works as expected.

Is this a bug or a feature?

-Michael






_______________________________________________

OSTech
http://community.qnx.com/sf/go/post69139


Attachment: Text winmail.dat 2.77 KB
RE: fesh,esh output redirection problem  
Actually, eecho is a fesh built-in.  Whether the behaviour is expected
or not, I'm not certain.

On Thu, 2010-09-30 at 10:28 -0400, Attilla Danko wrote:
> esh redirection works correctly for me in 6.5.0 M9:
> 
> #esh
> #echo "this is good" >good.txt
> #cat good.txt
> this is good
> 
> 
> 
> >"eecho
> 
> I'm assuming you meant to write "echo" with one e.
> 
> -ad
> 
> 
> -----Original Message-----
> From: Michael Tasche [mailto:community-noreply@qnx.com]
> Sent: Thu 2010-09-30 08:14
> To: ostech-core_os
> Subject: fesh,esh output redirection problem
> 
> Hello all,
> 
> "eecho Teststring >testfile" results in an empty file and the output
> string is printed to the console.
> 
> All (f)esh buildin commands seems to behave like this.
> If you start a normal process from the embedded shell, redirection
> works as expected.
> 
> Is this a bug or a feature?
> 
> -Michael
> 
> 
> 
> 
> 
> 
> _______________________________________________
> 
> OSTech
> http://community.qnx.com/sf/go/post69139
> 
> 
> 
> 
> 
> 
> _______________________________________________
> 
> OSTech
> http://community.qnx.com/sf/go/post69168
> 
> 
RE: fesh,esh output redirection problem  
Redirect support is not enabled for either print or eecho. 

Attilla Danko <community-noreply@qnx.com> wrote:

esh redirection works correctly for me in 6.5.0 M9: 

#esh
#echo "this is good" >good.txt 
#cat good.txt
this is good



>"eecho

I'm assuming you meant to write "echo" with one e.

-ad


-----Original Message-----
From: Michael Tasche [mailto:community-noreply@qnx.com]
Sent: Thu 2010-09-30 08:14
To: ostech-core_os
Subject: fesh,esh output redirection problem
 
Hello all,

"eecho Teststring >testfile" results in an empty file and the output string is printed to the console.

All (f)esh buildin commands seems to behave like this.
If you start a normal process from the embedded shell, redirection works as expected.

Is this a bug or a feature?

-Michael






_______________________________________________

OSTech
http://community.qnx.com/sf/go/post69139






_______________________________________________

OSTech
http://community.qnx.com/sf/go/post69168