Skip to main content
avoid xpath splitting
Source Link
athena
  • 12.5k
  • 8
  • 61
  • 137
if type xcode-select >&- && xpath=$( xcode-select --print-path ) &&
   test -d $"${xpath}" && test -x $"${xpath}" ; then
   #... is correctly installed
else
   #... isn't correctly installed
fi

Strangely, the --print-path isn't documented in old Xcode versions but is working as -print-path. On the other hand, the -p option doesn't have this compatibility.

if type xcode-select >&- && xpath=$( xcode-select --print-path ) &&
   test -d ${xpath} && test -x ${xpath} ; then
   #... is correctly installed
else
   #... isn't correctly installed
fi

Strangely, the --print-path isn't documented in old Xcode versions but is working as -print-path. On the other hand, the -p option doesn't have this compatibility.

if type xcode-select >&- && xpath=$( xcode-select --print-path ) &&
   test -d "${xpath}" && test -x "${xpath}" ; then
   #... is correctly installed
else
   #... isn't correctly installed
fi

Strangely, the --print-path isn't documented in old Xcode versions but is working as -print-path. On the other hand, the -p option doesn't have this compatibility.

english
Source Link
athena
  • 12.5k
  • 8
  • 61
  • 137
if [type xcode-xselect `xcode>&- && xpath=$( xcode-select --print-path`path ]) &&
   test -d ${xpath} && test -x ${xpath} ; then
   #... is correctly installed
else
   #... isn't correctly installed
fi

Strangely, the --print-path isn't documented in old Xcode versions but is working as -print-path. On the other hand, the -p option doesn't have this compatibility.

if [ -x `xcode-select -print-path` ] ; then
   #... is installed
else
   #... isn't installed
fi
if type xcode-select >&- && xpath=$( xcode-select --print-path ) &&
   test -d ${xpath} && test -x ${xpath} ; then
   #... is correctly installed
else
   #... isn't correctly installed
fi

Strangely, the --print-path isn't documented in old Xcode versions but is working as -print-path. On the other hand, the -p option doesn't have this compatibility.

Source Link
athena
  • 12.5k
  • 8
  • 61
  • 137

if [ -x `xcode-select -print-path` ] ; then
   #... is installed
else
   #... isn't installed
fi