FreeBSD-13.2p9 , bash-5.2.21
I have a script that when edited contains more text than is displayed when that file is
When I use cat -n then I see this:
And if I leave out the -n option then I see this:
Why does not cat list all the contents of the file; and why does the output from
I have a script that when edited contains more text than is displayed when that file is
cat
'ted. Thus:
Code:
# vim bin/pf_block_perm.sh
1 #!/usr/bin/env bash
2 # pf_blockperm.sh 2022-05-06 JBB
3 # -q quiet sft 2022-05-30 JBB$
4 # Generate PF blocklist from invalid user attempts on sshpipe hosts
5
6 # Set BLOCKPERM table file name
7 BT='/var/db/pf/pf_block_perm'
8 # Set Whitelist file name
9 WT='/var/db/pf/pf_white_list'
10 # Poll all sshpipe hosts
11 for N in {1..3}
12 do
13 ssh -q sshpipe-$N \
14 "touch pf_block_perm ; \
15 grep 'Invalid user' /var/log/auth.log | rev | cut -d ' ' -f 3 | rev | \
16 sort -u > pf_block_perm"
17 echo "get pf_block_perm pf_block_perm.sshpipe-$N" | sftp -q -b - sshpipe-$N
18 done
19
20 # Only have one webmail service host active ATM 2022-05-27
21 # The webmail block_perm generation script is located on the service hosts
22 for N in {2..2}
23 do
24 ssh -q webmail-$N.internal.harte-lyne.ca \
25 "touch pf_block_perm ; \
26 /root/bin/pf_block_perm_webmail.sh"
27 echo "get pf_block_perm pf_block_perm.webmail-$N" | \
28 sftp -q -b - webmail-$N.internal.harte-lyne.ca
29 done
30
31
32 ### merge the new blocklists with the old
33
. . .
When I use cat -n then I see this:
Code:
# cat -n bin/pf_block_perm.sh
1 #!/usr/bin/env bash
2 # pf_blockperm.sh 2022-05-06 JBB
3 # -q quiet sft 2022-05-30 JBB
4 # Generate PF blocklist from invalid user attempts on sshpipe hosts
5
6 # Set BLOCKPERM table file name
7 BT='/var/db/pf/pf_block_perm'
15 grep 'Invalid user' /var/log/auth.log | rev | cut -d ' ' -f 3 | rev | \
16 sort -u > pf_block_perm"
17 echo "get pf_block_perm pf_block_perm.sshpipe-$N" | sftp -q -b - sshpipe-$N
18 done
19
20 # Only have one webmail service host active ATM 2022-05-27
21 # The webmail block_perm generation script is located on the service hosts
22 for N in {2..2}
23 do
24 ssh -q webmail-$N.internal.harte-lyne.ca \
25 "touch pf_block_perm ; \
26 /root/bin/pf_block_perm_webmail.sh"
27 echo "get pf_block_perm pf_block_perm.webmail-$N" | \
28 sftp -q -b - webmail-$N.internal.harte-lyne.ca
29 done
30
31
32 ### merge the new blocklists with the old
33
. . .
And if I leave out the -n option then I see this:
Code:
# cat bin/pf_block_perm.sh
"touch pf_block_perm ; \
/root/bin/pf_block_perm_webmail.sh"
echo "get pf_block_perm pf_block_perm.webmail-$N" | \
sftp -q -b - webmail-$N.internal.harte-lyne.ca
done
### merge the new blocklists with the old
Why does not cat list all the contents of the file; and why does the output from
cat -n <file>
differ from cat <file>
?