I have tried the following questions:
I was running docker-compose
that checks Dockerfile.
See my script:
archlinux="pacman"
get_package_manager_install()
{
if [[ -x "$(command -v $1)" ]]; then
"$1 $2 $3"
else
echo "Gestor do pacote desconhecido" &>/dev/null;
fi
}
get_package_manager_install "$archlinux" "-S --noconfirm --needed" "ca-certificates curl git p7zip wget unzip zstd"
get_package_manager_install "$archlinux" "-S --noconfirm --needed" "htop micro neofetch neovim zsh"
get_package_manager_install "$archlinux" "-S --noconfirm --needed" "luit xdotool xdriinfo xorg-appres xorg-iceauth xorg-xcmsdb xorg-xgamma xorg-sessreg xorg-xdpyinfo xorg-xev xorg-xfd xorg-xfontsel xorg-xhost xorg-xkbcomp xorg-xkill xorg-xlsatoms xorg-xlsclients xorg-xlsfonts xorg-xmessage xorg-xmodmap xorg-xprop xorg-xrandr xorg-xrdb xorg-xrefresh xorg-xset xorg-xvidtune xorg-xvinfo xorg-xwininfo"
Observe that I also already have replaced "$1 $2 $3"
with $@
or $*
. I also attempted $(echo "$@")
and $(echo "${@}")
I also have already replaced " "
with ' '
in the last parameter, but unsuccessfully.
It cut the last part of the parameter, for example, git p7zip wget unzip zstd
and whole htop micro neofetch neovim zsh
will not be installed.
$*
or ~$@` in your script. – ctrl-alt-delor Mar 06 '22 at 11:03printf "<%s>\n" ...
which would print the args in a somewhat unambiguous format. (Also note that$*
,$@
,"$*"
and"$@"
are different.) – ilkkachu Mar 06 '22 at 11:10