Created
August 9, 2022 07:04
-
-
Save loneicewolf/5af77049673b61c2c1632e1d9783f10c to your computer and use it in GitHub Desktop.
bash - input checker, if arg is a file
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
#!/bin/bash | |
if [ $# != 1 ]; then | |
echo -ne "\e[31m[-] Input only 1 arg\e[00m\n" | |
else | |
echo -ne "\e[32m[+] 1 arg ok\e[00m\n" | |
if [ -f "$1" ]; then | |
echo -ne "\e[32m[+] arg 1 IS A file.\e[00m\n" | |
f="$1" | |
#echo "[*] exec: ls $f" | |
#ls --size --human-readable --inode --color=yes -1 "$f" | |
#echo "[*] exec: checksum $f" | |
#sha1sum "$f" | |
else | |
echo -ne "\e[31m[-]arg 1 IS NOT: a file OR found.\e[00m\n" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment