comparison lib/interp @ 996:859f9b4339e6

<Gregor> tar xf egobot.tar.xz
author HackBot
date Sun, 09 Dec 2012 19:30:08 +0000
parents
children d6d2d7192923
comparison
equal deleted inserted replaced
995:6883f5911eb7 996:859f9b4339e6
1 #!/bin/sh
2
3 export I_CMD="$0"
4 export I_ARG="$1"
5 export ARG_FILE="/tmp/input.$$"
6
7 get_arg() {
8 #if expr "$I_ARG" : "http://" > /dev/null
9 #then
10 # wget $WGET_OPTIONS "$I_ARG" -O "$ARG_FILE"
11 #else
12 printf '%s' "$I_ARG" > "$ARG_FILE"
13 #fi
14 }
15
16 clean_arg() {
17 rm -f "$ARG_FILE"
18 }
19
20 interp_stdin() {
21 get_arg
22 $1 < "$ARG_FILE" 2>&1
23 clean_arg
24 }
25
26 interp_file() {
27 get_arg
28 $1 "$ARG_FILE" 2>&1
29 clean_arg
30 }
31
32 interp_stdin_java() {
33 get_arg
34 cd $1
35 java $2 < "$ARG_FILE" 2>&1
36 clean_arg
37 }
38
39 interp_file_java() {
40 get_arg
41 cd $1
42 java $2 "$ARG_FILE" 2>&1
43 clean_arg
44 }