diff options
-rwxr-xr-x | gophed | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -33,7 +33,7 @@ trap cleanup INT QUIT HUP KILL ABRT TERM [ "$#" -lt 1 ] || [ "$1" = -h ] && usage -if [ "$0" = gophed ] && [ "$1" = -i ]; then +if [ "$0" = gophed ] && [ "$1" = -i ]; then ln -sf "$0" g ln -sf "$0" d ln -sf "$0" v @@ -51,13 +51,13 @@ if [ "$script_name" = gophed ] || [ "$script_name" = v ]; then exit 0 fi -if [ "$script_name" = g ] || [ "$script_name" = d ]; then +if [ "$script_name" = g ] || [ "$script_name" = d ]; then LINE="$(awk "{if (NR == '$2') print '$0';}" "$1")" RESOURCE="$(printf '%s' "$LINE" | cut -d ' ' -f 2)" HOST="$(printf '%s' "$LINE" | cut -d ' ' -f 3)" PORT="$(printf '%s' "$LINE" | awk -F ' ' '{ match($4,/[[:digit:]]+/); print substr($4,RSTART,RLENGTH) }')" - - if [ "$script_name" = g ]; then + + if [ "$script_name" = g ]; then SEL="$(printf '%s' "$RESOURCE" | sed -r 's:/:+:g')" TMPFILE="$(mktemp "/tmp/gophed_${HOST}_${SEL}_$PORT.XXXXXXXXXXXXXXXXXXX")" go "$RESOURCE" "$HOST" "$PORT" > "$TMPFILE" |