Created
January 4, 2017 19:55
-
-
Save Rotwang/f34fa746762657ac4d6f07f95ab169c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bartek@computingmachine:~$ cat wojtek | |
#!/usr/bin/env bash | |
wojtek="$(stat -L -c %f $1)" | |
case $((16#$wojtek >> 12)) in | |
1) echo FIFO ;; | |
2) echo Character dev ;; | |
4) echo Directory ;; | |
6) echo Block dev ;; | |
8) echo Regular file ;; | |
10) echo Symlink ;; | |
esac | |
bartek@computingmachine:~$ chmod +x wojtek | |
bartek@computingmachine:~$ ./wojtek /dev/sda | |
Block dev | |
bartek@computingmachine:~$ ./wojtek /dev/zero | |
Character dev | |
bartek@computingmachine:~$ ./wojtek /dev/std | |
stderr stdin stdout | |
bartek@computingmachine:~$ ./wojtek /dev/stdout | |
FIFO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment