shell: implement ternary operator