On 23/02/2026 23:10, Bernhard Voelker wrote:
On 2/23/26 23:26, Pádraig Brady wrote:
    kill -l $?       # show if last command was terminated with signal

I think this one is not correct: $? is the exit code of the previous command, 
not the signal.

    $ timeout -vs HUP 3 sleep 10
    timeout: sending signal HUP to command 'sleep'
    $ env kill -l $?
    kill: unknown signal: 124

Well timeout wasn't actually killed with a signal, so one can infer that from 
the error.
But yes it's a bad example because of the ambiguity between:
  $ sh -c 'kill -HUP $$'; kill -l $?
  HUP
  $ sh -c 'exit 1'; kill -l $?
  HUP

       mv *.jpg ./photos/

This form may fail if there are too many jpg files,
so we should avoid examples like that.
Perhaps it's worth showing:

     find . -name '*.jpg' -print0 | xargs -r0 mv -t photos/

I like showing the -t option, because it is often very useful.
Maybe avoid the NUL-termination options and --no-run-if-empty?

       find -name '*.jpg' -exec mv -t photos/ '{}' +

Not sure this is easier to read for beginners; find(1) is another world.

Yes that might be marginally better.
In general examples are a good way to show the utils in combination.

cheers,
Padraig.

Reply via email to