Save argument ${1} passed to a shell script in a v

2019-09-06 18:40发布

问题:

I want to save ${1} argument passed to my script (${1} is a file path) into a string variable within the same shell script, and then echo the path using echo variable and not echo ${1}.

回答1:

Simply try doing this :

myvar="$1"
echo "$myvar"


回答2:

Saving argument to variable 'var' ::

local var="${1}"

Echo the variable ::

echo "${var}"


标签: linux shell unix