bash script how to do wildcard string comparisons or matching

This is a feature that works very well in bash and is easy to do:

*Remember you need the double brackets for this specific test even though a normal if would not require them

variable="hi there"

if [[ "$variable" = hi* ]]; then

echo "yes it contains hi"

fi


Tags:

bash, wildcard, comparisons, matchingthis, feature, brackets, variable, quot, echo, contains, fi,

Latest Articles

  • nginx how to see the real IP when behind a CDN
  • Docker how to find real container child process ID
  • Alibaba Aliyun how to reset password solution 'Setup does not meet the requirements, please resetting'
  • RTL88X Series 80Mhz hostapd mode for Linux Debian Kali
  • How To Deploy Your Own Mastodon Server in Docker
  • ffmpeg burning subtitles in non-English errors [Parsed_subtitles_0 @ 0x561d3a0b3b80] Glyph 0x6709 not found, selecting one more font for (Sans, 700, 0)
  • rsyslog in container config
  • Interesting Whisper AI CPU vs GPU Test
  • How to install pytorch with cuda capability for AI acceleration with Nvidia Tesla etc.. GPUs
  • How to Spider the web archive.org to recover your old website/webpage
  • Debian 10 /etc/apt/sources.list
  • Linux Debian Cannot Upgrade Kernel Headers Missing Solution
  • How to install ZFS on Linux Ubuntu Debian Mint
  • How to Add Contrib Packages to Debian/Linux/Mint by editing /etc/apt/sources.list
  • Proxmox How To Purge Ceph
  • VMWare ESXi/VSphere Disable Balloon Segfault in Services Solution
  • Apache Linux Debian Ubuntu Container how to manually restart without killing
  • Docker enable UTF8 in Container to stop seeing gibberish ? characters
  • Debian 8 How To Use Apt Update Archive sources.list
  • Debian Live CD Password