0

Is it possible to convert code written in Java (just basics like aritmeticts, string operation, cycles/conditions - nothing complicated) and compile it into bash script ?

I don't have enough time to learn bash properly but I need to do some bash scripting quickly.

Can I just write it in Java and convert it into Bash ? I would be easier for me then learning bash from the scratch.

Or is there any other language which can be compiled into bash ?

jmt
  • 659
  • 1
  • 8
  • 23

1 Answers1

3

There's nothing currently to compile Java into bash.

Do you need to execute in bash? Could you just compile it and run in terminal using Java? Java allows you to execute shell commands, if that's all you need.

There are a few bash preprocessors, but they're relatively old and seem unmaintained. For example this or there are several mentioned here.

Regardless, learning to use a preprocessor will almost definitely take more effort than just learning bash, since you'll have to learn both at the same time.

Bash is a fundamental and ubiquitous language, and I would strongly encourage you to take the time to learn some basic scripting - it can make your life a lot easier.

Bricky
  • 2,143
  • 12
  • 27