-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libsmartcols] watch vs tty column detection #1160
Comments
In this case, lsblk (and other tools) does not assume it's executed on the terminal and it does not restrict output and columns width. It's the same as "lsblk > file". The ideal soution would be to improve watch(1) to execute commands in a own terminal (like script(1)), but it's not trivial ... Anyway, you do not need watch(1) at all ;-), you can use bash loop + clear:
(the command printf is there only to provide date and demostrate it works). For lsblk, we can add --output-width to restrict libsmartcols table formatting. I'll implement it as it seems usable in another use-cases too. EDIT: I'll use --width to keep it shorter. |
Addresses: #1160 Signed-off-by: Karel Zak <kzak@redhat.com>
A loop is ok – but watch does the difference highlighting 😎 |
Running
lsblk
underwatch
makes output overflow the terminal width; running outside ofwatch
makes columns adjust appropriately.Use case: wanted to have a live view of plugged in USB pen drives (whilest flashing our https://schulstick.org/ ).. but some devices have insanely long serial numbers xD
The text was updated successfully, but these errors were encountered: