Running smbstatus on the command line I get the following:
❯ smbstatus
Samba version 4.17.3
PID Username Group Machine Protocol Version Encryption Signing
----------------------------------------------------------------------------------------------------------------------------------------
Service pid Machine Connected at Encryption Signing
---------------------------------------------------------------------------------------------
No locked files
However, if I take this same type of command into a script like this:
#!/usr/bin/bash
SMB_STATUS="$(smbstatus)"
echo "Result: $SMB_STATUS"
I get the following:
No locked files
Result:
Samba version 4.17.3
PID Username Group Machine Protocol Version Encryption Signing
----------------------------------------------------------------------------------------------------------------------------------------
Service pid Machine Connected at Encryption Signing
---------------------------------------------------------------------------------------------
I'm actually trying to filter for the "No locked files" line, however I can't seem to do this in a shell script since it seems possibly two processes are being run in the background? I don't know. I'm at a loss how to explain what I'm seeing here.