add a case substitution function

This commit is contained in:
Tom 2025-02-02 14:30:50 +00:00 • committed by GitHub
parent 7ca239a84e
commit 21e06809b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -49,6 +49,10 @@ escape_sed() {
echo "$1" | sed -e 's/[]\/$*.^[]/\\&/g'
}
case_sed() {
echo "$1" | sed 's/.*/\L&/'
}
# Check if the mount point exists and if a USB drive is plugged in
usb_path=$(lsblk -o NAME,FSTYPE,SIZE,TYPE,MOUNTPOINT | grep -E "vfat|ext4|ntfs|exfat" | grep -E "sd[a-z]([0-9]*)" | awk '{print $1}' | sed 's/[^a-zA-Z0-9]//g' | head -n 1)
full_device_path="/dev/$usb_path" # Construct the full device path