Skip to content
Advertisement

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

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}.

Advertisement

Answer

Simply try doing this :

myvar="$1"
echo "$myvar"
Advertisement