Runnig shell command on osgi/kura stack - shell

How I can easily run shell command like ls on linux os behind kura?
I've tried classic java approach, but it not work.
Please help. Give me some guidelines, directions. It is very hard to find something on network.

You can use : org.eclipse.kura.executor.Command and org.eclipse.kura.executor.CommandExecutorService.

Related

How to execute a MATLAB script in cygwin?

As the title of the question says, I would like to call a matlab script from the cygwin shell in windows 7. Is there a way to do so? I could not find anything about it either here or anywhere else online.
Edit: I do not whish to call a unix command from within matlab, but rather the other way around. E.g. I want to do something like
$ matlab MatScript.m
from the cygwin shell.
The command matlab -r MathScript.m is probably what you are looking for.
And if it doesn't work, leave the file extension (".m") out.

Make executable erlang program on the Mac Terminal

I'm very new to Erlang. I've tried now several hours to find out how to run my sample scripts without the Erlang Shell.
I have installed Erlang with Mac Ports, and I can access the Shell, write Scripts etc.
But I try to run my program in the Mac Terminal.
On this page [1] they are using ecc and elink. I don't have these programs in my installation.
Can you please provide me a way, how I can solve my problem?
Thanks and regards
chris
[1] http://www.sics.se/~joe/sae.html
You need to add:
#!/usr/bin/env escript
at the beginning of your script and make it executable (as #nomulous said):
chmod u+x myscript
Then you can run it like this:
./myscript
if it is in your current directory, or by giving its relative or full path otherwise, e.g.:
~/Desktop/myscript
Reference: the page you gave section Erlang Scripts
If your script is not executable, it won't run outside of the shell.
To make it executable, use chmod +x your_script_here.
Try rebar (https://bitbucket.org/basho/rebar/wiki/Home) :)

Run a shell script on Windows - Drupal install using DAMP

i've installed DAMP on Windows Vista, and have created a profile in my drupal folder with a shell script that needs to run.
profiles/donor_rally/rebuild.sh
However, I don't know how to execute this shell script.
I am not familiar with shell script command language, would you be willing to provide me with a step-by-step instructions on how to execute this shell script?
Thanks.
It looks like you're trying to run a Bourne shell script, which would usually only run on a unix machine. Guessing from the name, this is supposed to rebuild something, likely the database, but that's just a guess.
The short answer is you can't run it, at least not easily. If you were to post the (edited) contents of the script you might get some answers about how you could port it to a Windows cscript or batch file.
For others who are uninitiated to shell scripting in Windows:
I did not find a straightforward solution for running shell scripts on AMP hosted on Windows.
Instead I got an account at webenabled.com
Then used PuTTy to tunnel in.
I found this guide to using UNIX: http://freeengineer.org/learnUNIXin10minutes.html
And lynda.com

Cygwin automatic script launch

Im trying to automatically run a script using Cygwin via CMD. I basically created a BAT file that goes to the directory and executes an .SH file. SH files are accosiated with Cygwin, and I tried something like "cygwin update.sh" in the command line. But all it really does is open Cygwin. I want Cygwin to automatically run the script file. Is there any easy way to do this, I've been trying to find but can't. Thank you!
You'll want to call the shell script with a particular shell, e.g. bash.
When having Cygwin open, call which bash to figure out where the binary is located. Cygwin also comes with tools that can convert paths between Cygwin and Win32 form, which is pretty helpful in cases like yours.
There is one other thing that may work, depending on your setup. There is an environment variable named PATHEXT which declares file extensions that are deemed "executable" by CMD. This can be used to your advantage, if Windows is configured so that the shell's "open" verb executes the correct shell for the file extension .sh (in your case).
Good luck.
From Cygwin Terminal, read man mintty. Try something like the following from a Windows Command Prompt:
c:\cygwin\bin\mintty --hold always --exec /cygdrive/c/path/to/bash/script.sh
I also found this!
http://rothmanshore.com/2011/01/26/kick-off-a-cygwin-script-from-a-windows-bat-file-with-a-different-working-directory/
I didn't quite understand it at first, but then it worked as I wanted it. Just if anyone knows, is there a way to make the script run without the CMD window open?? Thanks

Emacs ido-style shell

Is there a command line shell or shell customization that supports emacs-style ido find file? In emacs, I can navigate to a directory extremely quickly using C-x C-f and (ido-mode t).
Ideally, I'm looking for a solution that can be used outside of emacs. Though I'd be open for a way to quickly change directories within an eshell buffer.
Since I also wanted something like this, I tried to implement it as a bash completion
function. Obviously it means. you have to use bash.
It is only lightly tested, so please feel free to try and report bugs /comments.
http://pgas.freeshell.org/shell/bash-ido
Try the Z-shell. It has much better completion than bash. I must admit I haven't used it for a while though and stuck with bash because it's always available.
Bash has an environment variable called CDPATH which can contain a list of directories to search when using the cd command. Also, check out the "Programmable Completion" and "READLINE" sections of the Bash manual. You should be able to cobble together something that works for you.
The best I've been able to come up with so far is autojump. Still looking for a solution closer to ido, but autojump is a great little app.
I know that some terminal emulator support extension, for instance rxvt-unicode can be extended with Perl scripts. I'm not sure since i never wrote an extension myself, but maybe what you want is doable this way.
If you want to have a look at some Perl scripts for urxvt there are some examples in /usr/lib/urxvt/perl with the default urxvt install on Debian.
If you want ido completion in eshell or similar, it might be best to write a function that uses ido to read a directory, then inserts the command to cd to that directory into the shell buffer. I don't use eshell myself, so I couldn't comment on how to actually write this function, but it's an idea.
fzf, the command-line fuzzy finder, adds fuzzy completion for bash and zsh.
According to the developer:
It's an interactive Unix filter for command-line that can be used with
any list; files, command history, processes, hostnames, bookmarks, git
commits, etc.
This is a portable solution (works on Linux, Mac, Windows), which has no dependencies.

Resources