Skip to content

Commit

Permalink
Prefer 'command' over 'which' for RPM distro scripts
Browse files Browse the repository at this point in the history
'which' is not available at _all_ by default on Centos7
or Centos8 Docker images out of the box.

'command' is, and serves the same purpose in this case.

Example:

    $ docker container run -it --rm centos:7
    [root@a7ba6b6aca53 /]# command -v which
    [root@a7ba6b6aca53 /]# command -v command
    command
    [root@a7ba6b6aca53 /]# exit
    exit

    $ docker container run -it --rm centos:8
    [root@eca6d461750b /]# command -v which
    [root@eca6d461750b /]# command -v command
    command
    [root@eca6d461750b /]# exit
    exit
  • Loading branch information
bsolomon1124 committed Jan 15, 2021
1 parent 1779044 commit 1dd7684
Show file tree
Hide file tree
Showing 21 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion rpm/setup
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_0.10
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_0.12
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_10.x
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_11.x
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_12.x
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_13.x
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_14.x
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_15.x
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_4.x
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_5.x
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_6.x
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_7.x
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_8.x
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_9.x
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_current.x
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_iojs_1.x
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_iojs_2.x
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_iojs_3.x
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/setup_lts.x
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down
2 changes: 1 addition & 1 deletion rpm/src/_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ print_status() {
}

if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
ncolors=$(command -v tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
Expand Down

0 comments on commit 1dd7684

Please sign in to comment.