3 bup_python="$(dirname "$0")/bup-python" || exit $?
4 exec "$bup_python" "$0" ${1+"$@"}
10 from bup import options, _helpers
11 from bup.helpers import atoi, handle_ctrl_c, log, parse_num
15 bup random [-S seed] <numbytes>
17 S,seed= optional random number seed [1]
18 f,force print random data to stdout even if it's a tty
19 v,verbose print byte counter to stderr
21 o = options.Options(optspec)
22 (opt, flags, extra) = o.parse(sys.argv[1:])
25 o.fatal("exactly one argument expected")
27 total = parse_num(extra[0])
31 if opt.force or (not os.isatty(1) and
32 not atoi(os.environ.get('BUP_FORCE_TTY')) & 1):
33 _helpers.write_random(sys.stdout.fileno(), total, opt.seed,
34 opt.verbose and 1 or 0)
36 log('error: not writing binary data to a terminal. Use -f to force.\n')