diff options
| author | KatolaZ <katolaz@freaknet.org> | 2019-02-17 09:06:50 +0000 | 
|---|---|---|
| committer | KatolaZ <katolaz@freaknet.org> | 2019-02-17 09:06:50 +0000 | 
| commit | fdeee8ccf213f7e9f74b81abc7f0f96b28b35a6d (patch) | |
| tree | e508780ad1c0b944920e7a80293b328bbea40368 | |
| parent | aa624aff7cc03e780814f7447af1f7acf2873f7f (diff) | |
minor edits on variable quoting0.1
| -rw-r--r-- | README.md | 10 | ||||
| -rwxr-xr-x | gophed | 18 | 
2 files changed, 17 insertions, 11 deletions
| @@ -44,8 +44,14 @@ or equivalently:    ./v gopher://kalos.mine.nu  ``` -This command will download the corresponding resource, and print it on -output with line numbers. An excerpt is reported below: +This command will download the corresponding resource. If you want to  +print it on output with line numbers, just give the command: + +``` +%n [ENTER] +``` + +and you should see something like:  ```  ... @@ -32,16 +32,16 @@ usage() {  }  goto_url(){ -        URL="$(echo $1 | sed 's,gopher://,,g')" +        URL="$(echo "$1" | sed 's,gopher://,,g')"          hostport=$(echo "$URL" | cut -d "/" -f 1) -        host="$(echo $hostport | cut -d ":" -f 1)" -        port="$(echo $hostport | cut -s -d ":" -f 2)" +        host="$(echo "$hostport" | cut -d ":" -f 1)" +        port="$(echo "$hostport" | cut -s -d ":" -f 2)"          [ -z "$port" ] && port='70'          type=$(echo "$URL" | cut -s -d "/" -f 2)          [ -z "$type" ] && {  		type='1'                  sel="/" -		go $sel $host $port +		go "$sel" "$host" "$port"  		return          }          [ -n "${type#?}" ] && echo "Invalid Gopher URL" >&2 && exit 1 @@ -49,12 +49,12 @@ goto_url(){          type="$(echo $type | sed -n '/^[0-9ITghis+]$/p')"          [ -z "${type}" ] && echo "Invalid Gopher URL" >&2 && exit 1          sel=/$(echo "$URL" | cut -s -d "/" -f 3-) -        go $sel $host $port +        go "$sel" "$host" "$port"  } -trap cleanup INT QUIT HUP KILL ABRT TERM +trap cleanup INT QUIT HUP ABRT TERM  [ "$#" -lt 1 ] || [ "$1" = "-h" ] && usage @@ -72,7 +72,7 @@ if [ "$script_name" = "gophed" ] || [ "$script_name" = "v" ]; then  	sel="$(printf '%s' "$1" | sed -r 's:/:+:g')"  	TMPFILE="$(mktemp "/tmp/gophed_${2}_${sel}_$3.XXXXXXXXXXXXXXXXXXX")"  	goto_url "$1" > "$TMPFILE" -	while read line; do echo $line; done | ed -p "$PROMPT" "$TMPFILE"  +	while read -r line; do echo "$line"; done | ed -p "$PROMPT" "$TMPFILE"   	cleanup  	exit 0  fi @@ -87,7 +87,7 @@ if [ "$script_name" = "g" ] || [ "$script_name" = "d" ]; then  		SEL="$(printf '%s' "$RESOURCE" | sed -r 's:/:+:g')"  		TMPFILE="$(mktemp "/tmp/gophed_${HOST}_${SEL}_$PORT.XXXXXXXXXXXXXXXXXXX")"  		go "$RESOURCE" "$HOST" "$PORT" > "$TMPFILE" -		while read line; do echo $line; done | ed -p "$PROMPT" "$TMPFILE" +		while read -r line; do echo "$line"; done | ed -p "$PROMPT" "$TMPFILE"  	fi  	if [ "$script_name" = "d" ]; then  		DIR_RESOURCE="$(dirname "$RESOURCE")" @@ -98,7 +98,7 @@ if [ "$script_name" = "g" ] || [ "$script_name" = "d" ]; then  	cleanup  	exit 0  fi -printf '%s: command not found\n' "$scriptname" +printf '%s: command not found\n' "$script_name"  cleanup | 
