Advertisement
orgads

Converting paths from remote posix server to local win

Feb 13th, 2013
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.53 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Runs $2 (e.g. ./buildAll.sh), and translates paths in stderr from local to remote (given by $1) path
  4.  
  5. if [ $# -lt 2 ]; then
  6.   echo "usage: $0 <local_path> <build_script> [arguments]"
  7.   exit 1
  8. fi
  9.  
  10. # current directory's parent (should be run from inside TrunkPackRam)
  11. LOCAL="$PWD"
  12. # revert backslashes
  13. REMOTE="$(echo "$1" | sed 's|\\|/|g')"
  14. shift
  15. RUN="$1"
  16. shift
  17. exec 3>&1
  18. # redirect stderr to stdout and stdout to 3, then restore stdout to stderr
  19. $RUN "$@" 2>&1 1>&3 | sed "s|$LOCAL|$REMOTE|g; s|/|\\\\|g" 1>&2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement