Raja G
Raja G

Reputation: 6693

find command with variable

I have a file which contain a build version in a folder. I have assigned that version stored in a file but somehow I couldnt find it with if I use variable

[root@centos deploy]# VERSION=1234.56789
[root@centos deploy]# echo $VERSION
1234.56789
[root@centos deploy]# find . -name '*$VERSION*'
[root@centos deploy]# find . -name '*1234.56789*'
./abcd_1234.56789_apr13.rar
[root@centos deploy]# find . -name '*`$VERSION`*'
[root@centos deploy]#

Please help.

Thank you.

Upvotes: 1

Views: 1419

Answers (1)

heemayl
heemayl

Reputation: 42147

Variables won't expand when put inside single quotes, you need to use double quotes:

find . -name "*$VERSION*"

Upvotes: 3

Related Questions