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

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -