Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

shell script in eclipse to allow redirection of files via standard in  RSS feed

 
Rooks Forgenal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Say I want to use this command in eclipse. java myProg < text.txt
I can't. Eclipse will not allow redirection of files via the shell command "<" because the built-in console is not a shell (or so i have been told)
However, if I run a shell script from eclipse, can I do it then?
On the assumption that I can, how do i configure eclipse to run a shell script? I can't find a decent walkthough for the setup. Right now, it only sees a *.sh as a text file and thus cannot execute it.
I supposed I should mention i am working in Windows XP.
I should also mention that I have only once written a working shell script. It was as follows:

This works great in a terminal on a Linux machine and this is the script I would like to use now on the windows XP machine through eclipse.

Any help is appreciated. For those who wish to suggest I google it, I have done so and I could not find anything useful or dumbed down enough for me to understand.
 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, that's a tough one. You can install a package like Cygwin, which would allow you to open a bash terminal on your Windows machine, and then work like you do on Linux. (Personally, I find Windows to be almost useless without the addition of Cygwin.) I really don't have any idea how you'd run a bash script from within Eclipse though, and I'm even having trouble understanding why you'd want to.
 
Rooks Forgenal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The goal or rather, the "why" I would want to do this is simple. I want to debug my C programs in Eclipse.

My C executable requires the redirection of an arbitrary number of files and/or file types for parsing, tokenizing or whatever i need to do with them. Those files are too large to read in all at once, so i am using stdin. I want to look for errors in eclipse gdb because I positively HATE working in emacs and/or using DDD or the like. I mean no offense to those who use them. I started programming after the turn of the century. I prefer to use tools made for tomorrow's programming projects; I intend on using the easiest of these tools available to me. I will go to great lengths to avoid being forced to use those archaic (though admittedly powerful) tools. I really don't know why there is no fully formed IDE built on top of a BASH. Get EVERYTHING a BASH can do inside the GUI and then add the IDE bells and whistles. [likely wishful thinking]

To clarify, I am trying to go through a bash script because if I write it correctly, I will not be forced into opening a shell and manually typing the operators or running the script from that shell. I don't mind if a shell is running in the background, I just don't want to have to interface with it.

There might come a time when I have reached the limits of what an IDE is capable of, and if that time is upon me, I might grudgingly open a shell, but I am not willing to give up just yet.

There... I said it. I am not ashamed. I am a programmer who does not like the command-line. I don't like typing in manual commands when I could have a button for that. When I want to find something, I look for it through a GUI tree using my mouse. I like my mouse. I love my mouse. My name is is jake and I am a mouse-a-holic.
 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All right, no need to go so defensive. I didn't realize there were programmers "born" in the 21st century who still used C to process files!

So you have a C plugin for Eclipse? I guess I sort of knew such a thing was possible, but it's just never come up for me. I gave up C programming a decade or so ago, and have never gone back. In any case, if you are debugging the programs, it suggests you have the source, and if you have the source, you can change the interface to work with a list a files passed as arguments, but to still read from standard in if no arguments are provided. That's pretty standard for UNIX commands anyway, so you'd be following a strong tradition.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!