Skip to content

Commit a71b2d0

Browse files
committed
general: Remove redundant usage of cat
In general, the substitution ‘$(cat foo)’ may be replaced by the equivalent but faster ‘$(<foo)’.
1 parent a2f3f41 commit a71b2d0

File tree

8 files changed

+8
-11
lines changed

8 files changed

+8
-11
lines changed

modules/archive/functions/archive

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

1313
if (( $# < 2 )); then
14-
cat >&2 <<EOF
14+
>&2 <<EOF
1515
usage: $0 [archive_name.zip] [/path/to/include/into/archive ...]
1616
1717
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
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/python/init.zsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function _python-workon-cwd {
5757
# Check for virtualenv name override
5858
local ENV_NAME=""
5959
if [[ -f "$PROJECT_ROOT/.venv" ]]; then
60-
ENV_NAME="$(cat "$PROJECT_ROOT/.venv")"
60+
ENV_NAME="$(<"$PROJECT_ROOT/.venv")"
6161
elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]]; then
6262
ENV_NAME="$PROJECT_ROOT/.venv"
6363
elif [[ "$PROJECT_ROOT" != "." ]]; then

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)