I need to run a fortran (77) script from the Windows 10 command window, but it should be a one-liner. The reason is that the fortran scipt - a file called external_command.f - is actually part of a Matlab script, where I can run external code through the operating system's command window (by using the ! "bang" symbol or system()-command. I quickly want to point that out without focusing too much on Matlab). But I'm having trouble doing that in Windows.
So far I tried:
using a fortran compiler for Windows, like Msys2 (which has the functions of gfortran, as far as I understand). However, it looks like I have to start Msys2 first, which then opens a separate window, which Matlab doesn't seem to be able to use because it's not Windows cmd anymore
installing gfortran in Ubuntu using Windows 10's WSL (Windows Subsystem for Linux). Same problem here: the cmd window changes to a Ubuntu terminal before I can use any fortran scripts. Furthermore, I can't easily change files located in Windows with commands from within a virtual machine
If it's not possible to run fortran scripts in Windows 10 in a one cmd line, I'd appreciate some guidance on how to change my approach.
EDIT: after Ronald kindly explained in a comment how fortran works I think this whole (rather complicated) question is just based on my own misunderstanding of fortran. I'm pretty sure I can now solve the issue after compiling my fortran code and using the resulting exe file in my cmd-window.
I'm trying to debug a crash in my program running on cygwin. The program has been compiled and linked using visual studio 12 tools. A trial license for the full vs12 version has been installed so presumably we have access to the vs12 debugger. I've never used this before, I'm more familiar with command line tools in linux like gdb or lldb on osx. It doesn't seem that gdb is installed on our windows machines and I don't have admin access. I'd like to simply run a backtrace on the program at the point at which it fails. Can anyone give a quick start for using the debugging tools on cygwin/windows? I've tried the following
$devenv /debugexe /winsame/swsides/myexec 'program-options'
A microsoft visual studio window opens up, but again I'm not clear on where to start. It would be great if there was a simple command line interface.
Well I am relatively new in computer's world, and I learned programming on a virtual machine using linux S.O. I am using minGW32 command prompt, and I can compile and run my c codes as needed, however I recently installed gdb debugger (for debugging my programms), and it is bit uncomfortable to write:
"c:\mingw\bin\gdb.exe" exe_name
in order to debug my programs. Is there a way for having something like:
gdb exe_name
like in linux?
Thanks in advance.
extra question: And the same for valgrind?
best regards
You should add the path "c:\mingw\bin" in your environment variable. This way whenever you type gdb on command prompt, it would search from the above path.
And the same for valgrind?
Till date Valgrind does not run on Windows platform.
I'm Windows user. But according to my project requirements, I need to write Linux Shell Script(Bash shell). How to develop Linux Shell on Windows?
Is there any IDE for writing Linux Shell Scripting? Please share me some ideas and resource links.
You have quite a number of options:
cygwin
Install cygwin. It will give you a bash.
mingw
The minimal GNU for windows. Comes with set of commands, compilers. This came with my Git on Windows and now the default shell for small scripts
VM, such as VirtualBox
There are tons on VMs, VirtualBox being easy to use(it powers the Boot2Docker). You can do development and test on real Linux distros.
Ubuntu on Windows 10
There is new kid on the block. This allows you to run User Space Ubuntu using Windows Subsystem for Linux (WSL). see more on it at Microsoft blog
Other notes/IDE support
Shell scripts should be small, requires less IDE etc. I use VIM with syntax highligthing. But it seems ShellED may be useful in your case. I got the link from answer for this question - Bash script plugin for Eclipse?
IntelliJ has couple of plugins too for Bash..
I prefer Gow (Gnu on Windows) over Cygwin. Both will give you bash on Windows, but Cygwin has unnatural conventions for filesystem access (/cygdive/c/some/path instead of c:\some\path).
The native windows command terminal is pretty lame, take a look at Conemu.
I'm not aware of any bash IDE, but there are a plethora of windows text editors with decent syntax highlight for bash scripts. I like Notepad++ and Sublime text (the multiple cursor feature from Sublime rocks!). I don't recommend bash for anything with more than 30 lines, if you ever feel the need for an IDE, perhaps the task is more suited for Python, Ruby or Perl (IMHO Python is more maintainable).
The Bash shell is coming to Windows 10 in the upcoming Anniversary Update (Redstone).
The Bash shell is coming to Windows. Yes, the real Bash is coming to Windows, said Microsoft's Kevin Gallo at Build 2016 keynote. This is not a VM [Virtual Machine]. This is not cross-compiled tools. This is native."
Here's the steps to run Bash on Windows 10 OS:
Open the Windows Start menu
Type "bash" [hit enter]
Which opens a console running Ubuntu's /bin/bash with full access to all of Ubuntu user space
Yes, you are right, that means apt, set, ssh, rsync, find, ls, grep, awk, sed, sort, xargs, md5sum, gpg, curl, wget, apache, mysql, python, perl, ruby, ruby gem, php, gcc, tar, vim, emacs, diff, patch, nano...and most of the tens of thousands binary packages available in the Ubuntu archives!
Reference
Step-vise Guide to Enable Windows 10’s Ubuntu Bash Shell (Windows Subsystem for Linux)
The Bash shell is coming to Windows 10 in the upcoming Anniversary Update (Redstone).
Run native Bash on Ubuntu on Windows
Since you need to write linux shell scripts, you are learning Linux. So you should install Linux on your machine (preferably on its own partition and boot from it, otherwise in a VM).
Using cygwin or whatever imitation of Linux shell is not using Linux. You'll learn a lot more by installing and using Linux (and by developing on it with an editor like emacs or gedit or gvim ....). Also, take advantage that Linux is almost entirely free software, so you can study its source code and improve it.
Not installing Linux is not doing yourself a favor.
I believe cygwin is for those who love Linux but have to use Windows. It cannot give you the entire Linux feeling (e.g. you won't be able to write shell scripts looking into /proc which does not exist in Windows, even with cygwin).
If you want to use a simple environment emulating all Linux environment as alternative to cygwin (more lightweight) you can try mingw and you can use notepad++ or emacs or vim to provide some syntax highlight on sh scripts.
Everyone has said to go full Linux or use various mocks.
Cloud9.io is a good option if you don't need that much.
You can set up a "workspace" which can be accessed online, lets you write in literally any language similar to np++, but the best part is, it's an online Linux, so you have a terminal, with all your shell commands - no mock up, no dual boot.
The downside to this is that the free users aren't given that much power, so if you wanted to execute some high-level maths or output a large image, it will crash as you will be using too much memory. But it is still really worth getting into, it's only ever crashed once on me, and I do some pretty memory-intensive things.
There is cygwin , that's a linux console for windows.. so you can execute all the linux command with it.
Install Cygwin to execute the commands. However you can use NotePad++ as editor which has native windows binaries.
http://www.cygwin.com/
http://notepad-plus-plus.org/
For Eclipse Luna Should use this one old version fails on UI error
Help > Install New Software… > Add…
Name: ShellEd
Location: http://sourceforge.net/projects/shelled/files/shelled/update/
I had a similar problem.
I like both Linux and Windows, and I am working on both systems, but for programming (and generally, for text editing) I use Windows, for different reasons. For example, I write C/C++ code on Windows, using the Windows DevC++ IDE, then I can compile this project on Linux, by sharing the files on LAN. Now I have to write long scripts, and I would like to do it in a similar way. Ok, maybe its a special request, but maybe I am not the only one who works in such a mixed environment.
First, I tried notepad++ (it is suggested by others as well), but does it support syntax highlight for Linux scripts? I didn't found this feature...
Then I tried gedit compiled for Windows. It requires the GTK library installed (actually it was already on my Windows). Gedit has syntax highlight for scripts!
So I suggest using gedit for Windows for this case. The edited script can not directly be started/tested with it, but for editing, it is fine!
Does anyone know how to run/compile Ruby programs on Windows 7? For example you can compile Java in Eclipse, but I can't seem to find one for Ruby.
http://rubyinstaller.org/ - "The easy way to install Ruby on Windows".
Will give you the language and execution environment - everything you should need to get started.
Ruby isn't compiled, but rather interpreted. You need to install Ruby using the above link given by #ilollar.
Then, if you have the source code of a program in the file some_ruby.rb, you will execute this in cmd:
ruby some_options.rb
This is the general form of a ruby command:
ruby [ruby options] [program name] [program options]
Here is a free online book that will answer most of the question you have about Ruby if you are just starting out: http://ruby.learncodethehardway.org/book/
It's called "Learn Ruby the Hard Way", but don't let the name throw you off - the book is actually pretty easy to follow and doesn't assume you know anything about programming.
It will get you started writing Ruby and running programs for the first time.
Like ilollar said, the Ruby Installer is the best way to put Ruby on your Windows computer.
I'm currently running Ruby on Windows 7 writing Rails applications. You can do a lot on Windows with Ruby, however, you can't do everything. There are bundles of files that you can download that will help you write your Ruby programs - they are called Gems. Some gems will not run on Windows - The Ruby Racer and some versions of EventMachine are two that immediately come to mind.
This can be frustrating, but if it ever happens you can install a version of Linux in a virtual machine on your Windows computer so that you can use these gems without having to get a new machine.
You can also install Linux to run alongside Windows without having to reformat or mess with the partitions on your hard drive. There is a program called 'Wubi' that will install Ubuntu (a version of Linux) to run inside your Windows machine. It will actually let you pick Windows or Linux when you start your machine.
But all this is stuff to think about later on. You can certainly develop Ruby on Windows for now.
Also, in case you want to run just Ruby interactively, find the location where it is installed and browse to the bin subdirectory. For me this was \RailsInstaller\Ruby1.9.3\bin. In this directory there should be a file irb.bat. Double-click on it and you'll get a Ruby console session.
You can create window executables with ocra. That way you can create the app and push the app to another pc that does not have Ruby installed on it.