[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Shell function.



On 15/05/2025 22:42, peter@easthope.ca wrote:
Given this function.

You have not described use cases

ev () { case $# in
   0) /usr/bin/evince --display=:0 ;;
   1) /usr/bin/evince --display=:0 $1 ;;
   *) echo "Too many arguments." ;; esac }

Can improvements be suggested?

Install shellcheck or use it online: <https://www.shellcheck.net/>

In - line 3:
  1) /usr/bin/evince --display=:0 $1 ;;
                                  ^-- SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 1) /usr/bin/evince --display=:0 "$1" ;;

For more information:
  https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...



Reply to: