Find the answer to your Linux question:
Results 1 to 2 of 2
How do I setup an if-then command to examine if a device with a particular UUID is present? Example: Code: if [ -e UUID=FE45-BA45 ] then sudo mkdir /media/userdrive/ sudo ...
  1. #1
    Linux User Agent-X's Avatar
    Join Date
    May 2005
    Location
    Dimension X
    Posts
    261

    Question Using if-then commands on a UUID

    How do I setup an if-then command to examine if a device with a particular UUID is present?

    Example:
    Code:
    if [ -e UUID=FE45-BA45 ]
    then
    sudo mkdir /media/userdrive/
    sudo mount -t ext3 -U FE45-BA45 /media/userdrive/
    else
    echo
    echo "Drive not present."
    echo
    fi
    Thanks again!

  2. #2
    Linux User Agent-X's Avatar
    Join Date
    May 2005
    Location
    Dimension X
    Posts
    261
    Another win for the UUID system:

    Solved.
    blkid in puppy, probably vol_id in debian-types

    Code:
    #!/bin/sh
    blkid > /home/username/.uuidcheck
    #############################
    if grep 443A-426C "/home/username/.uuidcheck"
    then
      mkdir /media/woah
      mount -t vfat -U 443A-426C /media/woah
    fi
    This could be used for more devices, just add more if-then commands to the same script.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...