linux - bash if statement expected unary operator -
linux - bash if statement expected unary operator -
i'm trying along lines of
if (!regular file || symbolic link) go on
what have far is
st1=$( -f "${array[$i]}" ) if [ "$st1" -eq 0 ]
but i'm getting "expected unary operator error"
you don't need create intermediate st1
variable. use:
if [[ ! -f "${array[$i]}" || -h "${array[$i]}" ]]; echo "${array[$i]} link exists" fi
your utilize of st1=$( -f "${array[$i]}" )
wrong , cause syntax error:
-f: command not found
since shell consider f
command name.
linux bash if-statement
Comments
Post a Comment