Skip to content

Instantly share code, notes, and snippets.

@for2ando
Last active October 16, 2022 13:10
Show Gist options
  • Save for2ando/b5b02a80ae8f3d45dd4ecfcceaa9b3e1 to your computer and use it in GitHub Desktop.
Save for2ando/b5b02a80ae8f3d45dd4ecfcceaa9b3e1 to your computer and use it in GitHub Desktop.
A wrapper for non-BSD install command to behave as a BSD's install command when using -v option.
#!/bin/bash
## Let non-BSD install command to behave as a BSD's install command
## when using -v option.
verbosep=false
case "$1" in
-*v*) verbosep=true;;
esac
$verbosep && {
target="$3/$(basename $2)"
stamp_old="$(ls -l $target)"
}
install "$@" && $verbosep && {
stamp_new="$(ls -l $target)"
test "$stamp_old" != "$stamp_new" && echo install "$@" || true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment