Skip to content

Commit 84e0787

Browse files
committed
general: Remove redundant usage of cat
In general, the substitution ‘$(cat foo)’ may be replaced by the equivalent but faster ‘$(<foo)’. See: https://zsh.sourceforge.io/Doc/Release/Expansion.html#Command-Substitution
1 parent 3c002f7 commit 84e0787

File tree

7 files changed

+7
-10
lines changed

7 files changed

+7
-10
lines changed

modules/archive/functions/archive

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
local archive_name path_to_archive _gzip_bin _bzip2_bin _xz_bin _zstd_bin
1111

1212
if (( $# < 2 )); then
13-
cat >&2 <<EOF
13+
>&2 <<EOF
1414
usage: $0 [archive_name.zip] [/path/to/include/into/archive ...]
1515

1616
Where 'archive.zip' uses any of the following extensions:

modules/archive/functions/lsarchive

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
local verbose
1111

1212
if (( $# == 0 )); then
13-
cat >&2 <<EOF
13+
>&2 <<EOF
1414
usage: $0 [-option] [file ...]
1515

1616
options:

modules/archive/functions/unarchive

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ local extract_dir
1515
local _gzip_bin _bzip2_bin _xz_bin _zstd_bin
1616

1717
if (( $# == 0 )); then
18-
cat >&2 <<EOF
18+
>&2 <<EOF
1919
usage: $0 [-option] [file ...]
2020

2121
options:

modules/dpkg/functions/deb-history

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ case "$1" in
2626
zcat $(ls -rt /var/log/dpkg*)
2727
;;
2828
(*)
29-
cat >&2 <<EOF
29+
>&2 <<EOF
3030
Commands:
3131
install - List installed packages
3232
upgrade - List upgraded packages

modules/utility/functions/prep

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
local usage pattern modifiers invert
1111

12-
usage="$(
13-
cat <<EOF
12+
usage="$(<<EOF
1413
usage: $0 [-option ...] [--] pattern [file ...]
1514

1615
options:

modules/utility/functions/psub

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
local usage pattern replacement modifiers
1111

12-
usage="$(
13-
cat <<EOF
12+
usage="$(<<EOF
1413
usage: $0 [-option ...] [--] pattern replacement [file ...]
1514

1615
options:

modules/utility/functions/zsh-help

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
# function zsh-help {
1111

12-
local usage="$(
13-
cat <<EOF
12+
local usage="$(<<EOF
1413
usage: $0 [--help] [--zsh-help-debug] [--all] search term(s)
1514
Options:
1615
--all - search for the term anywhere, not just at the start of a line.

0 commit comments

Comments
 (0)