Cross platform shell scripts [closed] - linux

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Is there a tool which translates windows batch to bash files and visa versa?

Yes, cross-platform coding is possible.
cross-platform scripting for windows, Linux, MacOS X
PowerShell is cross-platform (Windows, Linux, Mac):
See these links (yes, I know links are generally frowned upon, but this is a very general question!)
https://www.google.co.uk/search?q=powershell+cross+platform+scripting
cross-platform scripting for windows, Linux, MacOS X
https://blogs.msdn.microsoft.com/dotnet/2016/08/18/powershell-is-now-open-source-and-cross-platform/
https://blogs.msdn.microsoft.com/scxplat/2009/12/11/cross-platform-powershell-scripts-released/
https://github.com/PowerShell/PowerShell
Perl is also cross platform
How to write cross-platform perl code
Python can be, as long as no OS-specific libraries are used.

For some standard operations it is an easy task because some commands do the same job (e.g. more and less, cd, ipconfig and ifconfig, md and mkdir, ...). So for a basic prototype you just have to replace some commands.
But the majority of commands differs a lot regarding parameters etc. So it won't be a hard job, but a very time consuming one to look at every shell command including allowed parameters and expected parameter values and to "translate" them to the appropriate form for another OS.
I think that there are two main options for your task:
install bash on Windows10 (if you already switched to it) which offers you a basic bash shell so you can use linux commands on windows
use powershell and install it on Mac and Linux as well
Another option is to use interpreted programming languages which can run on both platforms (e.g. Perl or Python can do that job quite good)

Related

linux + convert sh script to bash + dose bash support previos sh script [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
we have a lot of sh scripts and we want to upgrade them to bash scripts
my question:
dose bash support any previous sh script ?
if not what need to know before we convert sh to bash ?
I mean what we need to change/replace in the sh script to be bash script
I have unfortunately seen only a limited number of attempts to convert shell scripts from legacy UNIX platforms to bash. Usually there were uneventful.
One interesting example I remember was a script which used non-POSIX-conforming expansion behavior for <<here documents to implement a goto, presumably to simplify porting .bat scripts from MS-DOS or Windows. (The “labels” started with a colon :.) This did not work in bash because it follows POSIX semantics, so here documents could not be used to conditionally remove sections of the shell script.
In practice, the larger issue is often with the programs called from the shell scripts, which can show behavioral differences as well.
So the answer is a rather unsatisfying “it depends”, I'm afraid.

How similar are Unix and Linux exactly? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I am a computer science minor and I do appreciate *nix a lot more since i started to delve into computer science. I used to be a windows fan boy and now i own two macs (as well as my PC which has windows and ubuntu on it).
I want to learn more about how linux was developed. I know that linux is only the kernel and the GNU is actually the most of what i am interfacing with. So when i type ls -al on my mac which uses unix how is it different from when i type ls -al on my Ubuntu boot on my PC? Does the difference actually lie in the differences between linux and unix? Or does unix use a non-GNU libraries for stuff like ls and cd?
So what exactly are the difference of linux and unix? Does Unix use GNU libraries for ls, cd, and all those common terminal operations?
First of all, you need to know that ... Linux Is Not UniX. :)
Good question, but it's difficult to give a straight answer.
The kernel is different. The design is different. The software is different (!)
That said, if you have Mac OS X (UNIX), you can build almost any command-line tool that was written for Linux.
Most of the free open-source software is compatible with both Linux ans UNIX, so depending on your level, you might never know the difference.
But technically, there's a huge difference. If you're on a hardware and driver-level you will start noticing differences, but if you're above those levels, you can easily write portable code.
Some people would claim that Linux is the poor-man's UNIX (which is probably also true), while others would say that Linux fixes the problems that UNIX has.
Due to the nature of the question (it's fairly broad), it's difficult to go in details.
I work with both and do not feel a huge difference. My UNIX was set up for me, so I'm basically a novice user there, but I had to install and configure parts of my Linux system myself.
I would say (in my own opinion) that most of the time, Linux is something you build yourself, you decide which components you want. UNIX on the other hand is a little more "one big package", though you can still add components.
Looking at it from a different angle: Linux is open-source and free, where some versions of UNIX aren't. UNIX is often found in enterprise servers from large companies.
Take a command like 'ls' as you mentioned. Older versions of UNIX had a command called 'lc' which listed directories instead of files (as far as I recall). This command does not exist in the UNIX that Mac OS X is based upon, so there's a difference between UNIX and UNIX.
On the other hand, Linux did not make a straight copy of the UNIX command 'ls'. The output often differ slightly, and the switches are different. But!
If you're running Bash, then Bash on your Mac OS X is most likely exactly the same Bash you've got on Linux, just the version differ.
If you got 'curl' on your Mac, and 'curl' on Linux, then it IS the same tool, because it's built from the same sources; it's just built for two different Operating Systems.
GCC is the same as well. (GNU is Not Unix - but it works well on UNIX).
If you install the gitolite server (which I'm quite fond of), you will experience that it will not install on the stock Mac OS X 10.5.8; this is because the arguments for the 'cp' command differ. The author refused to correct the problem, when I suggested him a solution that would work on all platforms. So 'cp' may not always be 100% compatible, and I do not know whether or not it would be a good idea to 'upgrade', because the 'cp' that you have now is compatible with the scripts that Apple provided with your system. Upgrading 'cp' to a different version could break compatibility, which could mean that your system got corrupted and would need a re-install. -So it's better to not upgrade that particular command. ;)

Simple IDE for Pascal for Linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I am looking for a IDE for Pascal. Something that runs under Linux, is simple and easy to run. My goal is to setup something for a kid to learn, something that wouldn't require to derive from 10 classes to make a text visible on screen.
I remember DOS-based TurboPascal being very easy to use. Now I tried Lazarus, but its interface is very complex.
I don't need IDE that works with multiple languages, and I won't change Pascal into another language--there's lots of good textbooks in my native language for Pascal, and very little for other.
Thanks!
What about using FreePascal with its included editor or a basic text editor, like nano or gedit? You could also use one of the old "Borland-ish" IDEs like PENG or RHIDE.
Look here:
http://www.freepascal.org/
More specific:
http://www.lazarus.freepascal.org/
You can try Eclipse plugin, which might work better for you:
http://www.gavab.etsii.urjc.es/wiki/pascaline/
Also, try this one:
http://en.wikipedia.org/wiki/Kylix_(software)
This is not strictly Pascal, but Delphi was spun off from Pascal.
Geany is also good. It supports
syntax highlighting
symbol-name auto-completion (which is akin to intellisense)
specifying compiler options
integration with build tools
Among several other features one would expect in a modern integrated development environment.
Plus it's open source and runs across *nix, MacOSX and Windows.
You can always run the original Turbo Pascal 7 inside Dos-Box.
Dos-Box is available for Linux and comes with Free-Dos installed.
Very good alternative.
wrong on all counts. Embercardero has a community dev version for Sindows- ports to OSX, needs (an emu) some add-ons for linux. FP is the ported version of the old DOS app- with inheritance and classes--there really isnt something you seek. Its wither fp/rhide or Lazarus. You might want to brush up on UI programming or SDL. Im sorry but after ten + years of developing, Ive not seen anything "easier"- unless you write the code to make it easier. Pascal is far from dead. Further- you might try python. Four lines of code to a UI application(tkinter lib). TP7 is not a solution, fp ide is the same.

What's the easiest way (language, tools, etc) to write quick-n-dirty ad-hoc GUI apps in Linux? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
For example to create a simple form with couple of controls, doing some simple logic on them, generating a shell command or a web service call and executing it here and now, assuming that it is going to be no tomorrow for this application, no unexpected things can occur to be handled, computer resources are unlimited, etc. The code'd be compact and readable, everything'd fit in 1-2 files, better no special project/solution/makefile at all.
One way would be using Tool Command Language. It supports rapid prototyping, scripted applications, GUIs and testing.
Python with Gtk is easy to use.
If you are looking for prompting + user options then zenity is what you need. A command line prompting tool for use mostly in shell scripts.
www.pygtk.org might be exactly what you are looking for.
Well if you are familiar with C/C++ then you can try using gtk+-2.0. There are lot of sample tutorials and online help available for both..
If you're keen on using straight shell scripts zenity gives you just enough power.
If you prefer a language with a cleaner syntax and also a bit more power/flexibility python+gtk is a very good option.
Python + Tkinter if you want to write entire GUI based apps. Zenity if you want a slap a GUI onto your shell scripts.
GNU Dialog. Tutorial from Linux Journal: http://www.linuxjournal.com/article/2807

How can I improve my programming experience on my Linux Desktop? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
How can I improve the look and feel of my Linux desktop to suit my programming needs?
I found Compiz and it makes switching between my workspaces (which is something I do all the time to make the most of my 13.3" screen laptop) easy and look great - so what else don't I know about that make my programming environment more productive/pleasing?
#Rob Cooper - thanks for the heads-up, hope this reword addresses the issues
I found that the best programming experience comes from having quick access all your tools. This means getting comfortable with basic command line acrobatics and really learning keyboard shortcuts, flags, and little productivity apps.
I find that most of my workflow comes down to just a few apps and commands:
Terminator
SVN commands - ci, co, status, log, etc.
Command Line FTP
Vim
Basic Command lines operations (cd, rm, mv, cp, touch, grep, and std i/o redirection comprise 80% of my work day)
Not to say that GUI apps aren't necessary. A few I use:
Diffmerge
RapidSVN
Filezilla
VirtualBox
GnomeDo (this really should be first)
When it comes down to it, the real improvement in programming experience comes from just that - programming experience. Just pick a set of tools and stick with them until you know them inside and out.
I've used by Ubuntu desktop for some coding sessions. I haven't settled on an IDE, but if I'm not using gedit, I'll use emacs as my editor. Sometimes I need to ssh to a remote server and edit from there, in which case emacs is preferred. I'm just not the vi(m) type.
Maybe I'll try out Eclipse one day...
I love Compiz, but it does nothing for my coding experience. It's just eye candy. You can do desktop switching and Alt-Tab just fine without it. Aside from that, Jeff Atwood's recommendations for good chair, multi-monitors, and simplistic background still apply for me.
If you have half decent 3D acceleration on board, CompizFusion adds attractive desktop effects like mapping your workspaces onto a cube using that to switch between them/move windows between them. Looks pretty and improves general usability - great!
http://en.wikipedia.org/wiki/Compiz

Resources