# Call legato app from sh; returning/echoing values

**URL:** https://forum.legato.io/t/call-legato-app-from-sh-returning-echoing-values/5411
**Category:** Legato Linux distribution (Yocto project)
**Created:** [September 16, 2020, 11:51pm UTC](https://forum.legato.io/t/call-legato-app-from-sh-returning-echoing-values/5411 "2020-09-16T23:51:21Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Frank\_W](https://avatars.discourse-cdn.com/v4/letter/f/b782af/32.png) [@Frank\_W](https://forum.legato.io/u/Frank_W)
#### Post date: [September 16, 2020, 11:51pm UTC](https://forum.legato.io/t/call-legato-app-from-sh-returning-echoing-values/5411/1 "2020-09-16T23:51:21Z")

</div>

Hi there,

this seems to be so simple, I must oversee something.

I want to echo some information from an app and call this app from the command line.  
What I mean:  
If I call “date” in my shell, I receive the current date and time because the application that’s called by “date” prints it to the command line  
If I call “app start myApp”, I got… silence. printf and LE\_INFO are redirected to a logfile, I receive no output at all.

How can I print the output of my application to the command line (preferably without any other overhead messages like “Starting Legato App blablabla”)?

My goal is to call my app using a cgi script and process the output of the app.

Thank you and best regards

Frank

---

<div class="post-metadata">

### Author: ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)
#### Post date: [September 17, 2020, 12:01am UTC](https://forum.legato.io/t/call-legato-app-from-sh-returning-echoing-values/5411/2 "2020-09-17T00:01:50Z")

</div>

You might have a look on the cm tool as it can print message to command line.

> **[legato-af/apps/tools/cm at master · legatoproject/legato-af](https://github.com/legatoproject/legato-af/tree/master/apps/tools/cm)**
>
> master/apps/tools/cm

---

<div class="post-metadata">

### Author: ![Frank\_W](https://avatars.discourse-cdn.com/v4/letter/f/b782af/32.png) [@Frank\_W](https://forum.legato.io/u/Frank_W)
#### Post date: [September 17, 2020, 9:43am UTC](https://forum.legato.io/t/call-legato-app-from-sh-returning-echoing-values/5411/3 "2020-09-17T09:43:47Z")

</div>

Thanks, that helped.

My issue was that my app was sandboxed. In this case you cannot call it from a script (at least didn’t work for me), unsandboxing helped; app will be found in /legato/systems/current/apps//read-only/bin. This can than be called from a script.

Don’t forget to call exit(EXIT\_SUCCESS) to avoid error messages to flow into your command result.

Path to the CM script that you know from your command line: [legato-af/apps/tools/scripts at master · legatoproject/legato-af · GitHub](https://github.com/legatoproject/legato-af/tree/master/apps/tools/scripts)
