May 4, 2007 #1 sumncguy IS-IT--Management May 22, 2006 118 US I left my keys at home and cant get to my Unix in a nutshell book. How can I check a var for two elememts ie var="car boat" or var="car" if [ $var has two elements ] then echo "got 2" fi Thanks
I left my keys at home and cant get to my Unix in a nutshell book. How can I check a var for two elememts ie var="car boat" or var="car" if [ $var has two elements ] then echo "got 2" fi Thanks
May 4, 2007 #2 feherke Programmer Aug 5, 2002 9,540 RO Hi A stupid one, but I do not remember other now. Code: if [ `echo "$var" | wc -w` -eq 2 ] then echo "got 2" fi Feherke. http://rootshell.be/~feherke/ Upvote 0 Downvote
Hi A stupid one, but I do not remember other now. Code: if [ `echo "$var" | wc -w` -eq 2 ] then echo "got 2" fi Feherke. http://rootshell.be/~feherke/
May 4, 2007 Thread starter #3 sumncguy IS-IT--Management May 22, 2006 118 US Yeah ok dat will work .... yeah the other is something line ${#var} ... sumtimers is kicking in Tks Upvote 0 Downvote