Apr 22, 2004 #1 frangac Technical User Feb 8, 2004 163 ZA Hi All, How can I use a wildcard in the if statement for e.g chris=/dog/cat/mouse/biscuit (Something like this ) if [[ $chris = "%biscuit" ]];then echo Yes else echo No fi Many Thanks Chris
Hi All, How can I use a wildcard in the if statement for e.g chris=/dog/cat/mouse/biscuit (Something like this ) if [[ $chris = "%biscuit" ]];then echo Yes else echo No fi Many Thanks Chris
Apr 22, 2004 1 #2 vgersh99 Programmer Jul 27, 2000 2,146 US #!/bin/ksh chris=/dog/cat/mouse/biscuit if [[ $chris = @(*biscuit) ]]; then echo Yes else echo No fi vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
#!/bin/ksh chris=/dog/cat/mouse/biscuit if [[ $chris = @(*biscuit) ]]; then echo Yes else echo No fi vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Apr 22, 2004 Thread starter #3 frangac Technical User Feb 8, 2004 163 ZA Hi Vlad, Simple but nice. Thanks a mil Chris Upvote 0 Downvote
Apr 22, 2004 #4 aigles Technical User Sep 20, 2001 464 FR Also : [tt] #!/bin/ksh chris=/dog/cat/mouse/biscuit if [[ $chris = *biscuit ]]; then echo Yes else echo No fi [/tt] Jean Pierre. Upvote 0 Downvote
Also : [tt] #!/bin/ksh chris=/dog/cat/mouse/biscuit if [[ $chris = *biscuit ]]; then echo Yes else echo No fi [/tt] Jean Pierre.
Apr 23, 2004 #5 PHV MIS Nov 8, 2002 53,708 FR And yet another way, not dependant on ksh: case $chris in *biscuit) echo Yes;; *= echo No;; esac Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 Upvote 0 Downvote
And yet another way, not dependant on ksh: case $chris in *biscuit) echo Yes;; *= echo No;; esac Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
Apr 23, 2004 #6 aigles Technical User Sep 20, 2001 464 FR Little typo error PH case $chris in *biscuit) echo Yes;; *) echo No;; esac Jean Pierre. Upvote 0 Downvote