Results 1 to 3 of 3
when I exec
RAID_FAILDEV_CHK=$(mdadm --detail /dev/md0 | grep -Z "Failed Devices")
RAID_FAILDEV_CHK will have the string "Failed Devices : 0"
The problem is that if I do
if [ "$RAID_FAILDEV_CHK" ...
- 11-06-2009 #1Just Joined!
- Join Date
- Nov 2009
- Posts
- 2
removing invisible character
when I exec
RAID_FAILDEV_CHK=$(mdadm --detail /dev/md0 | grep -Z "Failed Devices")
RAID_FAILDEV_CHK will have the string "Failed Devices : 0"
The problem is that if I do
if [ "$RAID_FAILDEV_CHK" = "Failed Devices : 0" ]
I get false. Why? I think there is a trailing return char in variable $RAID_FAILDEV_CHK. If so, how do I remove that char?
- 11-06-2009 #2Just Joined!
- Join Date
- Nov 2009
- Posts
- 2
I found the problem.
The command
RAID_FAILDEV_CHK=$(mdadm --detail /dev/md0 | grep -Z "Failed Devices")
will put " Failed Devices : 0" in variable RAID_FAILDEV_CHK. Notice the space in front of "Failed"
This is why
if [ "$RAID_FAILDEV_CHK" = "Failed Devices : 0" ]
will always return false.
Can somebody tell me why there's a space in front of "failed"?
- 11-06-2009 #3Linux User
- Join Date
- May 2008
- Location
- NYC, moved from KS & MO
- Posts
- 251


Reply With Quote

