Skip to content
This repository was archived by the owner on Mar 30, 2020. It is now read-only.

Commit 3f33ee5

Browse files
committed
Quote the argument to cat.
Otherwise things fail if you give a filename with a space in the path: deagol ~/Repos/personal/sysadmin-util $ ./ssh-test t\ t cat: t: No such file or directory cat: t: No such file or directory cat: t: No such file or directory cat: t: No such file or directory
1 parent 05577d0 commit 3f33ee5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

ssh-test

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,18 @@ fi
5151
# MAIN
5252
#
5353

54+
55+
# Calculate the longest hostname, to align columns if we can.
5456
longest_hostname=0
55-
for line in $(cat $1); do
57+
for line in $(cat "$1"); do
5658
length=${#line}
5759
[ $length -gt $longest_hostname ] && longest_hostname=$length
5860
done
5961

6062
RED='\033[1;31m'
6163
NC='\033[0m' # No Color
6264

63-
for line in $(cat $1); do
65+
for line in $(cat "$1"); do
6466
host=${line%:*}
6567
port=${line#*:}
6668
if [ ! -z "${port##*[!0-9]*}" ]; then

0 commit comments

Comments
 (0)