_vern_ Posted May 22, 2019 Share Posted May 22, 2019 (edited) Hello all, I'm really just posting this because I want to see if anyone else has experienced this behavior with grep in unraid. I don't think this is an issue with unraid per se. I have a bash shell script that I have been running for several years without issue. The day after I upgraded to 6.7 the script broke and I had no idea why. After a couple of hours of trouble shooting I discovered the line below, which the output is supposed to be saved to a variable, wasn't grabbing anything. Note: this is not the full line of code...just the part the demonstrates the behavior. virsh domblklist "domain" --details | grep ^file If you run this line at the command line in unraid, assuming you are running virtual machines, and replace "domain" with the name of a VM, it should return a line of information on the VM...or so it used to. When I run this now it returns nothing, which caused the variables to never get populated which caused the script to fail. If I drop the caret (regex), it returns what is expected. It appears the grep version changed in 6.7, but I can't find any information concerning any changes to grep that would have caused this behavior. So, I'm curious if anyone else has run across this behavior and maybe more importantly, educate me. It's just one of those little mysteries that causes me to slowly lose my sanity! Thanx! Edited May 22, 2019 by _vern_ Quote Link to comment
_vern_ Posted May 23, 2019 Author Share Posted May 23, 2019 Thank you...I have figured out what has changed. The virsh domblklist --details command output has changed...the line of data now begins with a space so the pattern "^file" no longer matches it. Mystery solved. Thank you for the reply! Quote Link to comment
John_M Posted May 23, 2019 Share Posted May 23, 2019 It just had to be something like that. Changing the behaviour of grep itself would result in untold chaos. Glad you sorted it. Sanity restored! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.