I am trying to delete an ipmi user, using ipmitool and Linux. For this, I need to set their name to \xFF.
So I have a command that looks like this:
ipmitool -I lanplus -H 192.168.1.100 -U admin -P password user set name 4 $(echo -e '\xFF')
If I put it into the bash prompt, it works and the user gets deleted.
If I put it into a bash file, that goes like:
!#/bin/bash
ipmitool -I lanplus -H 192.168.1.100 -U admin -P password user set name 4 $(echo -e '\xFF')
And run it via:
Test Delete User By File
${rc} ${output}= Run And Return Rc And Output ./delete_user.sh
Should Be Equal As Integers ${rc} ${0} msg="User not deleted"
It also works.
But when I run it this way
Test Delete User
${rc} ${output}= Run And Return Rc And Output ipmitool -I lanplus -H 192.168.1.100 -U admin -P password user set name 4 $(echo -e '\\xFF')
Should Be Equal As Integers ${rc} ${0} msg="User not deleted"
It stops working and ipmitool complains that the arguments are wrong in some way.
And the one thing I have noticed, is that when run in bash the line echo -e '\xFF'
gives me a �
symbol.
But when I run it via
${rc} ${output}= Run And Return Rc And Output echo -e '\xFF'
I get ÿ
.
Now, I am running my code remotely on a Linux machine from a Windows system via an SSH tunnel. There's also someone using Linux to Linux who says it just works without any adjustments.
I did try adding and removing an additional backslash.
I have also tried replacing the $(echo -e '\xFF')
with Eval chr(255)
.
It also gives me ÿ
and ipmitool says:
Set User Name command failed (user 4, name ÿ): Invalid data field in request.
I have also tried writing some Python code to this, but it is not working either and has similar problems.
I assume the problem might be with the encoding or the environment, but what can I do to try and fix it?