Re: using `myscript.sh` to change current env

2013-09-09 Thread Darac Marjal
On Sat, Sep 07, 2013 at 04:35:09PM +1000, Zenaan Harkness wrote: > I want to have a script, to change between a few prompts per the arg > supplied. This is so I can quickly change from my glorious > bells-and-whistles prompt to a plain prompt (eg for cut and paste to > debian-user, just "$ " or "#

Re: Re: using `myscript.sh` to change current env

2013-09-07 Thread Balamurugan
Dear Zenaan, I tried the same by putting those code in a script - myprompt.bash like below #!/usr/bin/bash PS1=': ' In terminal, when I run like '. ./myprompt.bash', it is working as expected. Also I tried with alias like below and that also worked for me. alias myprompt="export PS1=': '" S

Re: using `myscript.sh` to change current env

2013-09-07 Thread Zenaan Harkness
On 9/7/13, der.hans wrote: > Am 07. Sep, 2013 schwätzte Zenaan Harkness so: > > moin moin Zenaan, > > Rather than all the convolutions of command substitution, how about just > using a function that's in your profile or bashrc? > > $ cat /tmp/bashrc > function changeps() { > export PS1=':

Re: using `myscript.sh` to change current env

2013-09-07 Thread Zenaan Harkness
On 9/7/13, Zenaan Harkness wrote: > On 9/7/13, Zenaan Harkness wrote: >> So I thought, run the script in a subshell, executing the result, like: >> $ `ps1` >> >> The following 3-line script is meant to test exactly this: >> >> #!/bin/bash >> PS1=': ' >> echo "export PS1=$PS1" After trying a few

Re: using `myscript.sh` to change current env

2013-09-06 Thread der.hans
Am 07. Sep, 2013 schwätzte Zenaan Harkness so: moin moin Zenaan, Rather than all the convolutions of command substitution, how about just using a function that's in your profile or bashrc? $ cat /tmp/bashrc function changeps() { export PS1=': ' } $ . /tmp/bashrc $ changeps : Add a

Re: using `myscript.sh` to change current env

2013-09-06 Thread Zenaan Harkness
On 9/7/13, Zenaan Harkness wrote: > So I thought, run the script in a subshell, executing the result, like: > $ `ps1` > > The following 3-line script is meant to test exactly this: > > #!/bin/bash > PS1=': ' > echo "export PS1=$PS1" When I change the last line to this: echo "export PS1=\"${PS1}