1

I am trying to run a jar file in a shell script. And I want to assign the out put of that jar file and echo it out. I tried something like below.

#!/bin/bash

$the_output = "$(java -jar portalOutputFormater.jar $1 $2 $3 $4  2>&1 )"

echo the_output

My java program returns the output as 'output=var1_var2_var3_var4" for the four input parameters. But I am getting the output as..

portaloutputformatter.sh: line 3: =output=var1_var2_var3_var4: command not found

What I am I doing wrong here? I just need to run my jar file then assign it to variable and output the variable.

Thank You !

janos
  • 120,954
  • 29
  • 226
  • 236
user1438823
  • 1,273
  • 3
  • 18
  • 25

1 Answers1

5

Your bash syntax is all wrong. Here's a quick fix, but you do need to start learning some basics...

#!/bin/bash

the_output=$(java -jar portalOutputFormater.jar $1 $2 $3 $4 2>&1)

echo $the_output
janos
  • 120,954
  • 29
  • 226
  • 236