• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -x
2#
3# Usage: helper-copy-and-exec-from-tmp.sh /path/to/binary [args]
4#
5# Copies the given binary into a unique file in /tmp and executes it with
6# [args]. Exits with the same return code as the binary did.
7
8executable="$1"
9shift
10
11target_name=$(mktemp)
12cp "$executable" "$target_name"
13chmod +x "$target_name"
14
15"$target_name" "$@"
16rc=$?
17rm "$target_name"
18exit $rc
19