[IPython-User] totally replacing bash with IPython on my Linux system

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[IPython-User] totally replacing bash with IPython on my Linux system

Brian Merchant
I'd like to replace bash with IPython on my system, so that even files like .profile are in Python rather than shell script.

I have some confusion on the topic, even though asking a few questions on the matter. Here are the questions I have asked previously:

1) How can I replace bash with Python? http://unix.stackexchange.com/questions/176091/how-can-i-replace-bash-with-python

From the answer to that question, I learned how to automatically replace bash with IPython after log in.

2) .profile is written in shell script -- can I get my system to understand that I want it to execute a Python script instead? http://unix.stackexchange.com/questions/248477/profile-is-written-in-shell-script-can-i-instead-make-my-system-understand-th

From the answer to that question, I learned that .profile file is "sourced" rather than "executed" -- that is, the lines in .profile are run one by one, as if one were typing them into the shell.

So, my question now is: how do I get my base system shell to be IPython, so that it can source ".profile" scripts that have IPython magics/Python written inside them? For example, I'd like to write my .profile file using IPython magics/Python.

Kind regards,
Brian







_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|

Re: totally replacing bash with IPython on my Linux system

Nathan Goldbaum
Hi Brian,

This doesn't really answer any of your questions, but you might be interested in learning about the xonsh shell, which is a sort of combination of all the best parts of bash and python:


-Nathan


On Thu, Dec 10, 2015 at 11:45 AM, Brian Merchant <[hidden email]> wrote:
I'd like to replace bash with IPython on my system, so that even files like .profile are in Python rather than shell script.

I have some confusion on the topic, even though asking a few questions on the matter. Here are the questions I have asked previously:

1) How can I replace bash with Python? http://unix.stackexchange.com/questions/176091/how-can-i-replace-bash-with-python

From the answer to that question, I learned how to automatically replace bash with IPython after log in.

2) .profile is written in shell script -- can I get my system to understand that I want it to execute a Python script instead? http://unix.stackexchange.com/questions/248477/profile-is-written-in-shell-script-can-i-instead-make-my-system-understand-th

From the answer to that question, I learned that .profile file is "sourced" rather than "executed" -- that is, the lines in .profile are run one by one, as if one were typing them into the shell.

So, my question now is: how do I get my base system shell to be IPython, so that it can source ".profile" scripts that have IPython magics/Python written inside them? For example, I'd like to write my .profile file using IPython magics/Python.

Kind regards,
Brian







_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user



_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|

Re: totally replacing bash with IPython on my Linux system

Pete Forman-2
In reply to this post by Brian Merchant
Brian Merchant <[hidden email]> writes:

> I'd like to replace bash with IPython on my system, so that even files
> like .profile are in Python rather than shell script.
>
> I have some confusion on the topic, even though asking a few questions
> on the matter. Here are the questions I have asked previously:
>
> 1) *How can I replace bash with Python? *
> http://unix.stackexchange.com/questions/176091/how-can-i-replace-bash-with-python
>
> From the answer to that question, I learned how to automatically
> replace bash with IPython after log in.
>
> 2) *.profile is written in shell script -- can I get my system to
> understand that I want it to execute a Python script instead?*
> http://unix.stackexchange.com/questions/248477/profile-is-written-in-shell-script-can-i-instead-make-my-system-understand-th
>
> From the answer to that question, I learned that .profile file is
> "sourced" rather than "executed" -- that is, the lines in .profile are
> run one by one, as if one were typing them into the shell.
>
> So, my question now is: *how do I get my base system shell to be
> IPython, so that it can source ".profile" scripts that have IPython
> magics/Python written inside them? *For example, I'd like to write my
> .profile file using IPython magics/Python.
>
> Kind regards,
> Brian

To start ipython directly, bypassing bash, you need to alter your entry
in /etc/passwd. The last field of the entry will need to be changed from
/bin/bash to the full path of your ipython. It will probably need to be
added to /etc/shells too.

The ".profile" equivalents in IPython are in the startup folder of your
default profile.

http://ipython.readthedocs.org/en/stable/interactive/tutorial.html?highlight=startup

--
Pete Forman
https://payg-petef.rhcloud.com
(formerly on http://petef.22web.org/payg.html)

_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|

Re: totally replacing bash with IPython on my Linux system

gyro funch
On 12/10/2015 2:51 PM, Pete Forman wrote:

> Brian Merchant <[hidden email]> writes:
>
>> I'd like to replace bash with IPython on my system, so that
>> even files like .profile are in Python rather than shell
>> script.
>>
>> I have some confusion on the topic, even though asking a few
>> questions on the matter. Here are the questions I have asked
>> previously:
>>
>> 1) *How can I replace bash with Python? *
>> http://unix.stackexchange.com/questions/176091/how-can-i-replace-bash-with-python
>>
>>
>>
From the answer to that question, I learned how to automatically
>> replace bash with IPython after log in.
>>
>> 2) *.profile is written in shell script -- can I get my system
>> to understand that I want it to execute a Python script
>> instead?*
>> http://unix.stackexchange.com/questions/248477/profile-is-written-in-shell-script-can-i-instead-make-my-system-understand-th
>>
>>

Have you looked at xonsh?

http://xonsh.org/

-gyro

_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user