Lazar Paunovic Lazar Paunovic - 2 months ago 14
Bash Question

String filtering! shell linux

patt= "apk"
if [[ "$1" =~ $patt ]]; then
echo "[-] Name of aplication type WITHOUT .apk extension!!!!!"

else
some code...


Hey guys... i have a little problem with how to be sure to files vith extesion.apk cant be typed in!! Thanks

And this doesnt work at all!
ad.sh: apk: not found
ad.sh: [[: not found

Answer
pat="apk"


if [[ "$1" =~ "$pat" ]]; then
      echo "[-] Name of aplication is WITHOUT .apk extension is : $(echo "$1" |awk -F'.' '{print $1 }')"
fi

Example:

sh-4.1$ ./script.sh facebook.apk
[-] Name of aplication is WITHOUT .apk extension is : facebook
sh-4.1$
Comments