I have a cell with this content:
import os
os.mkdir('123')
name = '123'
!rm -r name
I want to pass the value of the variable name to the last line. How can I do this?
Try $. It will substitute the python variable.
!rm -r $name
You may need to use $name\.txt or {name}.txt in some cases.
!git clone https://[email protected]/$user/my-repo.git, where user is a Python variable and $GITHUB_AUTH corresponds to os.environ['GITHUB_AUTH'], which is correctly replaced with the corresponding value in the command above, as opposed to the variable user, which is replaced with an empty string.!git clone "https://"$GITHUB_AUTH"@github.com/"$user"/my-repo.git". I use similar command for managing git and files from buckets and it works perfectly for me :)!rm -r "$name"Use {}.
myvar = "/test"
!cd {myvar}