[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Built-in method for searching variable strings
|
From: |
Chris Down |
|
Subject: |
Re: [Help-bash] Built-in method for searching variable strings |
|
Date: |
Sat, 1 Nov 2014 16:05:31 +0000 |
|
User-agent: |
Mutt/1.5.23 (2014-03-12) |
It's not incredibly good looking, but you can do something like this to
check if the substring got replaced:
var=foobarbaz
if [[ $var == "${var/bar/}" ]]; then
echo "Doesn't have substring"
else
echo "Has substring"
fi
pgpLKiZqufn4E.pgp
Description: PGP signature