If you need to check if zip or rar file has password protection you can do it this way. For zip fip: crypted=$( 7z l -slt — $file | grep -i -c “Encrypted = +” ) if [ “$crypted” -eq “1” ]; then protected=1 fi And for rar: unrar x -p- -y -o+ “$file” 1>…
All posts tagged bash
Bash: sort IP addresses
It’s very easy sorting IP-list. For example you have file ‘ip-list’. To sort IP’s redirect file contents to following sort command. Also collect only unique IP’s in yours list. cat ip-list | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 | uniq >> sorted-ips Didn’t find the answer to your question?…