简体   繁体   English

字符串过滤! 外壳 linux

[英]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!!嘿伙计们...我有一个小问题,如何确保无法输入文件 vith extesion.apk ! Thanks谢谢

And this doesnt work at all!这根本行不通! ad.sh: apk: not found ad.sh: [[: not found

Don't use apk as a regex (strings as tapkey will match).不要将apk用作正则表达式( tapkey将匹配字符串)。

You'd better extract the extension and echo your message if it's equal to apk :如果它等于apk您最好提取扩展名并echo您的消息:

ext="apk" # no space before and after = sign
if [[ ${1##*.} == "$ext" ]]; then
  echo "[-] Name of aplication type WITHOUT .apk extension!!!!!";
fi

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM