samedi 30 juillet 2016

Bash Multiple Conditions in If Statement and Functions

I'm trying to check if the number of arguments is one and if functions that I wrote in my script previously are true , but it does not work:

if [ $# -eq 1 && echo "$1" | lgt && echo "Invalid Length - $1" && echo "$1" | checking_another_function_etc ]; then
echo "some output" && exit 1

"lgt" is a function name.

I was trying to use (( [[ [ quotes, multiple if statements but it didn't work either. Maybe I should separate the number of arguments checking and functions with qoutes, but I'm not shure how to do it.I'm wondering if it is even possible to pass echo command to if condition.

The thing is I need one echo statement after checking of all functions, but after each function I need its own echo statement.

Aucun commentaire:

Enregistrer un commentaire