OK, you really are a beginner.
I recommend you spend some time reading and learning about how to get around on Linux, or run openHAB on an OS that you are more familiar with.
-
On your Raspberry Pi you are running a Linux based operating system (OS) called Raspbian (probably the Jessy version since that is the latest). Just like Windows 10 and OSX, Raspbian is a generic platform upon which you run programs.
-
openHAB is a program that runs on top of, in this case, the Raspbian OS. It is a Java based program which lets it run on most OS’s, but since you are working with a Raspberry Pi with Raspbian Jessy I’ll limit the discussion to that.
-
openHAB supports addons which allow it to support communicating with different bindings. Two different types of these addons are called bindings and actions. Bindings allow one to represent something in the real world as an Item within openHAB (e.g. represent a zwave switch as a Switch in openHAB). Actions allow one to call something in the real world directly.
-
One such binding is the Exec binding. This allows one to represent a command entered on a command line as an Item. For example, have it execute a bash script when a Switch is toggled. The command line string and the shell script are executed by the OS completely outside of openHAB.
-
Similarly one such action is the executCommandLine action. This allows one to execute a command entered on a command line directly from within a Rule.
-
A Rule is a bit of code written in a language that openHAB knows how to understand which tells it to do something in response to some event. Your line above is a valid line calling executeCommandLine from a Rule that is executed by openHAB.
-
When you Putty/ssh login to the Raspberry Pi, you are interacting with Raspbian. openHAB may not even be running! So you must communicate with the command line you are using (almost certainly bash) in a way that it understands.
val results = executeCommandLine("/etc/openhab/configurations/scripts/iPhoneDetect.script", 5000) logInfo("iPhone", results)
is nonsensical to bash. That is the openHAB Rule’s language. -
What executeCommandLine does is pass the contents of the first String on to the operating system and says "Hey, execute this and tell me what it says.
-
So, when you Putty/ssh over to your Pi to execute this script yourself, all you type in is that first String.
/etc/openhab/configurations/scripts/iPhoneDetect.script
All of the above is really basic computer knowledge and is understood to be known by users of openHAB on Linux. Based on this I would not recommend moving forward with use of the Exec binding or the executeCommandLine action until you gain a bit more knowledge and experience about how Linux works. Or run openHAB on a Windows or OSX machine upon which you are more familiar in which case the string you would pass to executeCommandLine would be the same thing you would type in a CMD window.