title: How to check a disk for partitions for use in a script in Linux?
body: <p>I'm scripting something in Bash for Linux systems.  How would I check a disk for partitions in a robust manner?</p>
  
  <p>I could use <code>grep</code>, <code>awk</code>, or <code>sed</code> to parse the output from <code>fdisk</code>, <code>sfdisk</code>, etc., but this doesn't seem to be an exact science.</p>
  
  <p>I could also check if there are partitions in <code>/dev</code>, but it is also possible that the partitions exist and haven't been probed yet (via <code>partprobe</code>, as an example).</p>
  
  <p>What would you recommend?</p>