So I'm trying to git clone and cd into that directory using Google collab - but I cant cd into it. What am I doing wrong?
!rm -rf SwitchFrequencyAnalysis && git clone https://github.com/ACECentre/SwitchFrequencyAnalysis.git
!cd SwitchFrequencyAnalysis
!ls datalab/ SwitchFrequencyAnalysis/
You would expect it to output the directory contents of SwitchFrequencyAnalysis - but instead its the root. I'm feeling I'm missing something obvious - Is it something to do with being within the python interpreter? (where is the documentation??)
!
-prefixed commands runs in its own subshell -- so the!cd
starts a new shell, switches directories, and then kills that shell. The!ls
then starts anew in the current directory. Doing!cd SwitchFrequencyAnalysis && ls
would have worked, but using python'sos.chdir
is the cleaner approach here.