Thiyagarajan Anandan Thiyagarajan Anandan - 1 year ago 123
Linux Question

what does -d value in an if expression in shell?

I am trying to understand a part of search function written in a piece of code below is the expression mentioned.

if [ -d = $1]
<action block>

Answer Source

You can use it to determine if a directory exist like

if [ -d "$DIR" ]; then
   # code
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download