# Can you use mustache value in EXEC node

**URL:** <https://discourse.nodered.org/t/can-you-use-mustache-value-in-exec-node/88367>\
**Category:** General\
**Created:** [29 May 2024 21:21 UTC](https://discourse.nodered.org/t/can-you-use-mustache-value-in-exec-node/88367 "2024-05-29T21:21:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![k5map](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/k5map/32/47681_2.png) [@k5map](https://discourse.nodered.org/u/k5map)\
**Post date:** [29 May 2024 21:21 UTC](https://discourse.nodered.org/t/can-you-use-mustache-value-in-exec-node/88367/1 "2024-05-29T21:21:10Z")

</div>

If I want to use msg.payload in the command line of the EXEC node, is this possible? I tried using {msg.payload} as well as two and three mustaches without success. Anyone know how to do this?

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [29 May 2024 21:25 UTC](https://discourse.nodered.org/t/can-you-use-mustache-value-in-exec-node/88367/2 "2024-05-29T21:25:19Z")

</div>

No, but you can use a template node to build the payload you want before the exec node and then use the `append payload` option (iirc you can leave the command empty in the config so the whole cmd line can be passed in as the msg.payload)

---

<div class="post-metadata">

**Author:** ![k5map](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/k5map/32/47681_2.png) [@k5map](https://discourse.nodered.org/u/k5map)\
**Post date:** [29 May 2024 21:38 UTC](https://discourse.nodered.org/t/can-you-use-mustache-value-in-exec-node/88367/3 "2024-05-29T21:38:38Z")

</div>

Appreciate the suggestion but I failed to mention in my original post, I need to insert a variable in the middle of the command string. The reason for my question was I was hoping to avoid having to insert another node in front of the EXEC node. If that's not possible, I'll just use a Function node and move on.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [29 May 2024 21:54 UTC](https://discourse.nodered.org/t/can-you-use-mustache-value-in-exec-node/88367/4 "2024-05-29T21:54:28Z")

</div>

You can't use moustache but you can insert a value into the command - just tick the append msg.payload to append it then any other parameters afterwards...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/6/2614500e8f5c2d4c64a7e4df960beac9e07f26f9.png)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [29 May 2024 22:58 UTC](https://discourse.nodered.org/t/can-you-use-mustache-value-in-exec-node/88367/5 "2024-05-29T22:58:50Z")

</div>

You should be able to assemble a command line with Jsonata in an inject node, something like this (`ifconfig wlan0 | grep inet`)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/0/a01d87aa1c5daa47669670bb055931a41248cb0c.png)

---

<div class="post-metadata">

**Author:** ![k5map](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/k5map/32/47681_2.png) [@k5map](https://discourse.nodered.org/u/k5map)\
**Post date:** [30 May 2024 01:21 UTC](https://discourse.nodered.org/t/can-you-use-mustache-value-in-exec-node/88367/6 "2024-05-30T01:21:40Z")

</div>

@jbudd... thanks I think will work for my situation.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 August 2024 01:22 UTC](https://discourse.nodered.org/t/can-you-use-mustache-value-in-exec-node/88367/7 "2024-08-28T01:22:20Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
