-b FILE (conditional operator)

true if the file is a block special file. Such a file is also known as “block device”.

Examples

Different ways to test if a file is a block special file:
1
2
3
4
test -b /dev/sda && echo "block device"
[ -b /dev/sda ] && echo "block device"
# Bash
[[ -b /dev/sda ]] && echo "block device"
BashSupport Pro is a Bash IDE with support for -btry it now!
© 2020–2024 Joachim Ansorg
Imprint
Privacy Policy
Legal