Skip to content

Instantly share code, notes, and snippets.

@loneicewolf
Created August 9, 2022 07:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save loneicewolf/5af77049673b61c2c1632e1d9783f10c to your computer and use it in GitHub Desktop.
Save loneicewolf/5af77049673b61c2c1632e1d9783f10c to your computer and use it in GitHub Desktop.
bash - input checker, if arg is a file
#!/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