linux - [Solved-2 Solutions] Setting an argument with bash - ubuntu - red hat - debian - linux server - linux pc



Linux - Problem :

How to set Arguments to a Bash-Script ?

Linux - Solution 1:

Using an array:

INSTALL_OPT=(-Uvh --define '_transaction_color 3')
click below button to copy the code. By - Linux tutorial - team

then:

"$INSTALL_CMD" "${INSTALL_OPT[@]}" myPackage.rpm
click below button to copy the code. By - Linux tutorial - team

Linux - Solution 2:

Try this:

#!/bin/bash

IFS=$'\n'

INSTALL_CMD=rpm
INSTALL_OPT='-Uvh'
INSTALL_OPT_DEFINE='--define _transaction_color 3'

${INSTALL_CMD} ${INSTALL_OPT} ${INSTALL_OPT_DEFINE} myPackage.rpm
click below button to copy the code. By - Linux tutorial - team

Related Searches to - linux - linux tutorial - Setting an argument with bash