Rookie Rookie - 4 months ago 7
Bash Question

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

Answer

Simply try doing this :

myvar="$1"
echo "$myvar"
Comments