|The act of sudoing creates a new shell so the command line parameters are not transferred. Depending on how sudo is executed, the child environment is inherited from the parent. If so, before executing the sudo, try this:|
Do you now see myvar after executing the sudo:
In worst case, before executing the sudo, create the myvar in a file:
echo "myvar=$1" > /tmp/nails.txt
Now, you can source this after your sudo command creates a new shell:
Let me know if you have any comments or questions.