alternative to the grep trick

view full story

http://www.unix.com – Hi, We used to use the below commands often. Code: ps -ef|grep [a]bc ps -ef|grep abc|grep -v grep Both fairly returns the same result. For example, the process name is dynamic and we are having the process name in a variable, how we can apply the above trick. For example "a" is the variable which contains the process name abc, then Code: ps -ef|grep $a|grep -v grep This will work. But how we can implement the other trick ,using [] in this case. Any suggestions welcome. Thanks. (HowTos)