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.
smbstatus
version 4.9.5-Debian, though).smbstatus
andx=$(smbstatus); echo "$x"
return exactly the same thing here. Nothing's written to stderr that might get output first. – Chris Davies Dec 07 '22 at 16:52filter for
mean to you inI'm actually trying to filter for the "No locked files" line
- print that line or delete that line or something else? What do you wantSMB_STATUS
to contain? – Ed Morton Dec 08 '22 at 01:08