Artificial intelligent assistant

Use variable provided; else derive and use Trying to achieve the following using a script with no luck If value of variable is provided use it for further steps, else derive value executing a script which writes to a file and use it for further steps #!/bin/bash if [[ -z "$VER" ]] then echo "VER not provided; Deriving value from INT" ./get_ver.rb > VER endif echo "VER=$VER" > VER

Your script contains multiple syntax errors.

This is a fixed version:


#!/bin/bash
if [[ -z "$VER" ]]; then
echo "VER not provided; Deriving value from INT"
VER="$( ./get_ver.rb )"
fi
echo "VER=$VER" >VER


Notice the `;` before `then` and `fi` to end the `if`-statement.

To store the output of a command in a variable, use `$(...)` as above.

Use ShellCheck to check your shell scripts.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy b6e71e5d7b4225a214d81e1f9f382546