exec-in-last.sh 315 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. set -e -u
  3. verbose=
  4. if [ "$1" = "-v" ]; then
  5. verbose=1
  6. shift 1
  7. fi
  8. cd $(dirname $(realpath $0))/_dd
  9. last_dd=$(ls -t . | head -n 1)
  10. [ "$verbose" ] && echo "last datadir:" $last_dd
  11. cd $last_dd
  12. [ "$verbose" ] && echo "envs:" $(ls)
  13. cd $1
  14. [ "$verbose" ] && echo "services:" $(ls)
  15. cd $2
  16. shift 2
  17. exec $@