I am writing a Python script that is started by a .sh
file and accepts 2-3 parameters. I have written what I want in Java, but I'm not sure how to put in bash.
Scanner i = new Scanner(System.in);
String f, f1, f2;
System.out.print("Enter type: ");
f = i.next();
if (f.equals("a")){
System.out.print("Enter var1");
f1 = i.next();
// run "python script.py a [f1]"
}
else if (f.equals("b")){
System.out.print("Enter var1");
f1 = i.next();
System.out.print("Enter var2");
f2 = i.next();
// run "python script.py b [f1] [f2]"
}
This is what I have so far:
a="e"
b="test.txt"
c=""
python main.py "$a" "$b" "$c"
I've looked at How to concatenate string variables in Bash, but I'm not sure how to put it in a conditional statement.
How do I put the read-ins in conditional statements in bash?