zsh:autoload:crypt-*mount: Get basename natively
Use zsh's builtin history expansion modifiers `:t` to get the basename of the block device.
This commit is contained in:
@@ -258,7 +258,7 @@ crypt-mount() {
|
|||||||
[[ -b "$1" ]]
|
[[ -b "$1" ]]
|
||||||
|
|
||||||
local name mount_point
|
local name mount_point
|
||||||
name=crypt_"${1##*/}"
|
name=crypt_"${1:t}"
|
||||||
|
|
||||||
sudo cryptsetup open "$1" "$name"
|
sudo cryptsetup open "$1" "$name"
|
||||||
udisksctl mount -b /dev/mapper/"$name"
|
udisksctl mount -b /dev/mapper/"$name"
|
||||||
@@ -285,7 +285,7 @@ crypt-umount() {
|
|||||||
sync
|
sync
|
||||||
|
|
||||||
local name mount_point
|
local name mount_point
|
||||||
name=crypt_"${1##*/}"
|
name=crypt_"${1:t}"
|
||||||
mount_point="$(
|
mount_point="$(
|
||||||
findmnt -lo SOURCE,TARGET \
|
findmnt -lo SOURCE,TARGET \
|
||||||
| grep -F /dev/mapper/"$name" \
|
| grep -F /dev/mapper/"$name" \
|
||||||
|
|||||||
Reference in New Issue
Block a user