title: Sudo: parted: command not found while executing script to format disk
body: <p>I am trying to create a script to format a newly added disk on a VM in vmware. I want to run the script with a sudouser. </p>
  
  <pre><code>echo "- - -" &gt; /sys/class/scsi_host/host0/scan
  echo "scsi add-single-device 0 0 1 0" &gt; /proc/scsi/scsi
  dev=/dev/disk/by-path/*-scsi-0:0:1:0
  count=0
  while [ ! -r ${dev} ]; do
      count=$(($count+1))
      if [ $count -gt 5 ]; then
          echo "New disk for target is not visible by the OS"
          exit 1
      fi
      echo $count
      sleep 5
  done
  dev=$(readlink -f $dev) || exit 1
  parted -s -- $dev mklabel msdos
  </code></pre>
  
  <p>When I run the script as sudo ./mount.sh, the script fails saying "parted: command not found". I added the path for parted in the PATH variable for the sudouser. What am I missing? Where did I go wrong?</p>
  
  <p>I tried adding sudo to each command individually, then the script fails in the while loop. Do I need to add any more permissions for the sudouser? Or is there any implementation error? Am I missing something? Please help me. </p>
  
  <p>I observed that this happens when I try to run any of the commands in /sbin/
  sudo ifconfig throws sudo: ifconfig: command not found</p>