24 karma · joined Jan 5, 2020 (6y ago) · 10 submissions
comment 4mo ago · link · parent
comment 4mo ago · link · parent
docker image ls -a | stdbuf -oL sed -r 's/\s{2,}/\t/g' | { head -n1; tail -n+2 | sort -hrk5 -t$'\t'; } | column -ts$'\t'
I used docker since that's what I have installed and I assume the output is equivalent.sort's -t is set to tab for field separation.
stdbuf sets sed's output to only buffer a line at a time and flush, so the head in the {...} command group doesn't completely consume stdin's contents before it's passed to tail.
The column command recreates the space-aligned table based on tab-delimited input.
comment 11mo ago · link · parent
$ (sleep 10; false)
^Z
[1]+ Stopped ( sleep 10; false )
$ wait %% && echo ok || echo nok
[1]+ Exit 1 ( sleep 10; false )
nokcomment 2y ago · link · parent
A more classic-style profile switcher is available via the '-P' (or '-ProfileManager') command-line switch. If FF is in your $PATH you can run:
firefox -P
The '-P' switch can also take an argument of a profile name to open it directly.But yes, it would be nice if at least one of these options were exposed in the UI so it was more discoverable by users.
comment 3y ago · link · parent
comment 3y ago · link · parent
find does not pass arguments through an intermediate shell, so there are no quoting concerns with regard to spaces in filenames, etc.
And with the form of -exec terminated by a ; it runs a single command for each matching filesystem entry, so there will be no issues with exceeding the maximum argument size.
You can verify via strace:
$ touch 'a b.md' 'c d.md'
$ strace -fe execve find . -iname '*.md' -exec unbuffer ls {} \;
At the end of the exec chains you should see the following: execve("/bin/ls", ["ls", "./c d.md"] ...
execve("/bin/ls", ["ls", "./a b.md"] ...
The filenames are being passed through spaces and all.However if this were a real scenario, a better solution might be:
find . -iname '*.md' -exec unbuffer ls -1 {} +
(Look up the -1 flag for ls, and the + variant of -exec for find for details)