[Tutor] Raspberry pi 2 python help

Mats Wichmann mats at wichmann.us
Tue Jun 13 11:07:15 EDT 2017


On 06/13/2017 08:08 AM, DJ VIN Lom wrote:
> Can i create a script to have my pi change to a certian directory
> automaticlly after booting. I want it to be in a directory so when i ssh
> into it its ready and i dont need to spend time to do it. As well i dont
> want to carry a keyboard mouse and montor
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
> 

There are a ton of ways to do this, and none of the common ones involve
python at all.

<end-python-tutor-content>

The wording "have my pi change to a directory" doesn't match how it
works... each new shell is a new context, so you need to set things upon
entering that context - namely after ssh establishes the connection and
the Pi launches a login shell in response.

Examples:

On the Pi, in your .bashrc, stick a cd command at the end
On the Pi, in your .bashrc define a short alias for the cd you want, so
what you type is very short
On the Pi, set the home directory of the account you are going to ssh
into to be the directory
On your host end, feed a command to ssh that includes doing something at
the other end, along this model:

    ssh -t dj at pi 'cd /some/path && exec bash -l'



More information about the Tutor mailing list