Run the shell commands in Perl using system() function in Windows - windows

I am migrating some plugin from Linux to Windows.
Plugin is written using Perl and it has the function called system() that will execute the shell commands.
But I am migrating to Windows now. Any way I can run the linux command in windows using system() Per function?
Some Perl Module avail for this ?

You can run the system() command but there are caveats. A nice description is contained in Using system or exec safely on Windows. This article resulted in the Win32::ShellQuote module.

You want to run a linux command vie Perl in a windows shell? If so, try a Linux environment like Cygwin (www.cygwin.com). Otherwise you have to migrate your system calls as well.

Related

Calling Bash scripts from Matlab with W10 Linux subsystem?

I am making routinely system calls from Matlab (R2016b on W10 64) to integrate some ImageMagick functions. Now I have just read about the existence of the W10 Linux subsystem. Is it possible to call with this option given Bash scripts from Matlab that implement themselves long ImageMagick processing pipelines? And if yes how?
You can run a script from Matlab using !<script> or system(<script>). See this or this for calling convert as an example.
With
bash -c "command"
one can access the Bash shell from the Command Prompt, PowerShell, or elsewhere in Windows so this could be the way to call a Bash script from Matlab link .

How would I interface with the Linux terminal (bash for windows) using windows command prompt?

I just recently found out about using bash in windows. I had alot of fun installing linux programs onto my windows computer using bash and wondered how I would be able to run an automatic script so I dont have to export my display everytime I open bash.
I used to write scripts for cmd called batch scripting and I would be able to do everything cmd could do. Now that I have access to bash, I want to script a program that connects useful pieces of cmd with useful pieces of bash but I Can't find any results telling me how to call bash commands from cmd. Thank you - Zak Kaioken

Is Cmd Prompt the same as Ubuntu Terminal?

I'm sorry if this is a simple question:
I want to swap from ubuntu to windows for my web dev (personal preference). I'm used to using the terminal in ubuntu and the commands there and I was wondering whether the command prompt in windows is the same? Do the commands do the same?
If not, is there a way to get a terminal for windows the same as ubuntu?
No the Command prompt is not same as the Linux shell you may find some commands resembling to those of the shell in Linux (terminal) however to get a more Linux shell like environment you can install cygwin or GOW (Gnu on Windows). It will give you a bash.
You can find Cygwin here . and
You can find GOW here .
Its not the same, as others have answered, but since the latest version of windows 10 there is a way of running linux bash terminal in Windows.
Have a look in Bash on Windows.
It is actually running Ubuntu inside your Windows.
Windows is based on DOS but Ubuntu is based on Linux. Each of those has its own commands, with some similar commands. I personally prefer Linux commands as they are easier to understand and more simple than DOS commands. You can't use Linux commands in DOS nor the reverse.

Command prompt isn't integrating anything

I installed amazonCLI, as well as Cygwin, and changed the Path env variable to:
%SystemRoot%\System32\Wbem;C:\Program Files\Prio;C:\Program
Files\Diskeeper Corporation\ExpressCache\;C:\Program
Files\Amazon\AWSCLI\;C:\cygwin64\bin
When I open the command prompt, first of all it is directly pointing to
C:\Users\Stephane
(which I think is weird). And then when I input something like 'ls', the return error is:
'ls' is not recognized as internal or external command, operable program or batch file
Can you please help me know what I am doing wrong?
Thanks
From the error message you got, it's evident, that you are trying to execute Cygwin's commands from the Windows Console. That's also the reason, why it's executed in your Windows' profile directory instead of the Cygwin's one.
You should read the basics about using the Cygwin first, because it seems you don't know what Cygwin exactly is and how to use it. Maybe you don't need the Cygwin at all, it depends on what you need to accomplish. The is for example GnuWin tool set or UnxUtils, which are just a sets of standalone GNU tools compiled for Windows. Cygwin is more like system than standalone utilities. You can for example execute shell scripts under the Cygwin.
So it depends on your needs. But I simply can't imagine using Windows without Cygwin yet.
You can execute Cygwin's shell from the Windows Console, but I advice you to use MinTTY (which is in directory $CYGWIN_DIR/bin). MinTTY is a terminal emulator, which executes your Cygwin shell (bash by default).
To execute for example bash directly from the Windows Console, just execute $CYGWIN_DIR/bash.exe --login -i.

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

Resources