# Read a value from a script

**URL:** <https://community.openhab.org/t/read-a-value-from-a-script/4685>\
**Category:** Items & Sitemaps\
**Created:** [December 1, 2015, 4:37pm UTC](https://community.openhab.org/t/read-a-value-from-a-script/4685 "2015-12-01T16:37:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![crankycoder](https://community.openhab.org/user_avatar/community.openhab.org/crankycoder/32/70612_2.png) [@crankycoder](https://community.openhab.org/u/crankycoder)\
**Post date:** [December 1, 2015, 4:37pm UTC](https://community.openhab.org/t/read-a-value-from-a-script/4685/1 "2015-12-01T16:37:13Z")

</div>

Anyone have any luck reading a value from a local script? I want to add a string item to my config that will contain the server name the openhab process is currently running on (downside to a clustered environment 😄)

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [December 1, 2015, 5:13pm UTC](https://community.openhab.org/t/read-a-value-from-a-script/4685/2 "2015-12-01T17:13:59Z")

</div>

You need to provide the timeout value in the call to `val String result = executeCommandLine(String command, int timeout)` instead of the call that only takes the command argument or in your rule or bound the script to an Exec Binding String Item.

---

<div class="post-metadata">

**Author:** ![crankycoder](https://community.openhab.org/user_avatar/community.openhab.org/crankycoder/32/70612_2.png) [@crankycoder](https://community.openhab.org/u/crankycoder)\
**Post date:** [December 1, 2015, 9:18pm UTC](https://community.openhab.org/t/read-a-value-from-a-script/4685/3 "2015-12-01T21:18:39Z")

</div>

Thank you. That pointed me in the right direction. I ended up using the exec binding to read in my host name. had a hell of a time with the spaces between /bin/cat and hostname but eventually figured out that the @@ was needed and that fixed me up.
