BASH   18

debug-shell.sh

Guest on 25th May 2022 07:07:22 PM

  1. #!/bin/sh
  2.  
  3. for FILE in   "$@" ; do
  4.     if ! test -f "$FILE.orig" ; then
  5.         cp -a "$FILE" "$FILE.orig"
  6.     fi
  7. done
  8.  
  9. sed -i -e '1a \
  10. exec >>/tmp/debugsh$$\
  11. exec 2>&1\
  12. date \
  13. echo "$0 $*"\
  14. \set -x\
  15. set
  16. ' "$@"
  17.  
  18. sed -i -e '$a \
  19. date
  20. ' "$@"

Raw Paste


Login or Register to edit or fork this paste. It's free.