Last active
November 4, 2016 08:45
-
-
Save cpelley/606142480bdfdf6b8577d341cdccc516 to your computer and use it in GitHub Desktop.
Commandline utility to determine whether the given file is text/binary.
This file contains hidden or 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
#!/bin/bash | |
# Function to return whether the specified file is text/binary. | |
# Returning true/false | |
# | |
# Add this file to your PATH to make available and ensure that it has | |
# executable privileges. | |
# | |
# Example usage: | |
# istext <file> | |
[[ "$(file -b $1)" == *"text"* ]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment