9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Trying to override 'cd' command
@ 2015-06-07 23:29 Ryan Gonzalez
  2015-06-07 23:43 ` Ingo Krabbe
  0 siblings, 1 reply; 12+ messages in thread
From: Ryan Gonzalez @ 2015-06-07 23:29 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 492 bytes --]

Coming from a bash world, I really like knowing what directory I'm in at
the prompt. I tried putting this at the end of 'lib/profile':



fn cd{
    builtin cd $1
    prompt=('{pwd}^'% ' '    ')
}

cd $HOME



However, it doesn't work! The 'cd' command seems to do what it normally
does. The prompt stays at 'term% '. Does nothing.

-- 
Ryan
[ERROR]: Your autotools build scripts are 200 lines longer than your
program. Something’s wrong.
http://kirbyfan64.github.io/

[-- Attachment #2: Type: text/html, Size: 1051 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] Trying to override 'cd' command
  2015-06-07 23:29 [9fans] Trying to override 'cd' command Ryan Gonzalez
@ 2015-06-07 23:43 ` Ingo Krabbe
  2015-06-12 21:05   ` Ryan Gonzalez
  0 siblings, 1 reply; 12+ messages in thread
From: Ingo Krabbe @ 2015-06-07 23:43 UTC (permalink / raw)
  To: rymg19, 9fans

try it with 

fn cd{
	    builtin cd $1
	    prompt=(`{pwd}^'% ' '    ')
}

the difference is `{pwd} not '{pwd}.
 


> Coming from a bash world, I really like knowing what directory I'm in at
> the prompt. I tried putting this at the end of 'lib/profile':
> 
> 
> 
> fn cd{
>     builtin cd $1
>     prompt=('{pwd}^'% ' '    ')
> }
> 
> cd $HOME
> 
> 
> 
> However, it doesn't work! The 'cd' command seems to do what it normally
> does. The prompt stays at 'term% '. Does nothing.
> 
> -- 
> Ryan
> [ERROR]: Your autotools build scripts are 200 lines longer than your
> program. Something’s wrong.
> http://kirbyfan64.github.io/





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] Trying to override 'cd' command
  2015-06-07 23:43 ` Ingo Krabbe
@ 2015-06-12 21:05   ` Ryan Gonzalez
  2015-06-12 21:35     ` Bakul Shah
                       ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Ryan Gonzalez @ 2015-06-12 21:05 UTC (permalink / raw)
  To: Ingo Krabbe; +Cc: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 1069 bytes --]

Thanks for replying! Unfortunately, that doesn't change anything. Still
stuck at the 'term% ' prompt.


On Sun, Jun 7, 2015 at 6:43 PM, Ingo Krabbe <ikrabbe.ask@gmail.com> wrote:

> try it with
>
> fn cd{
>             builtin cd $1
>             prompt=(`{pwd}^'% ' '    ')
> }
>
> the difference is `{pwd} not '{pwd}.
>
>
>
> > Coming from a bash world, I really like knowing what directory I'm in at
> > the prompt. I tried putting this at the end of 'lib/profile':
> >
> >
> >
> > fn cd{
> >     builtin cd $1
> >     prompt=('{pwd}^'% ' '    ')
> > }
> >
> > cd $HOME
> >
> >
> >
> > However, it doesn't work! The 'cd' command seems to do what it normally
> > does. The prompt stays at 'term% '. Does nothing.
> >
> > --
> > Ryan
> > [ERROR]: Your autotools build scripts are 200 lines longer than your
> > program. Something’s wrong.
> > http://kirbyfan64.github.io/
>
>
>


-- 
Ryan
[ERROR]: Your autotools build scripts are 200 lines longer than your
program. Something’s wrong.
http://kirbyfan64.github.io/

[-- Attachment #2: Type: text/html, Size: 2100 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] Trying to override 'cd' command
  2015-06-12 21:05   ` Ryan Gonzalez
@ 2015-06-12 21:35     ` Bakul Shah
  2015-06-12 21:50     ` Anthony Sorace
  2015-06-13  8:02     ` Ingo Krabbe
  2 siblings, 0 replies; 12+ messages in thread
From: Bakul Shah @ 2015-06-12 21:35 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Fri, 12 Jun 2015 16:05:21 CDT Ryan Gonzalez <rymg19@gmail.com> wrote:
>
> Thanks for replying! Unfortunately, that doesn't change anything. Still
> stuck at the 'term% ' prompt.

Invoke rc with -l flag (in acme middleclick on win rc -l).



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] Trying to override 'cd' command
  2015-06-12 21:05   ` Ryan Gonzalez
  2015-06-12 21:35     ` Bakul Shah
@ 2015-06-12 21:50     ` Anthony Sorace
  2015-06-13  8:02     ` Ingo Krabbe
  2 siblings, 0 replies; 12+ messages in thread
From: Anthony Sorace @ 2015-06-12 21:50 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

It works:

	: root; fn cd {builtin cd $* ; prompt=(': '`{pwd}^'; ' '	')}
	: root; cd
	: /usr/a; cd /tmp
	: /tmp; 

If you’re still having trouble, paste a transcript like that, so we can see what’s going on.

Note also that spaces in file names will screw up the easy version of this. If you’re on a filesystem that likes such things, you might instead want something like this:

	: /Library/Desktop; pwd            
	/Library/Desktop Pictures
	: /Library/Desktop; fn cd {builtin cd $* ; cwd=`{pwd} ; prompt=(': '$"cwd^'; ' '	')}
	: /Library/Desktop; cd .
	: /Library/Desktop Pictures; 



> On Jun 12, 2015, at 17:05 , Ryan Gonzalez <rymg19@gmail.com> wrote:
> 
> Thanks for replying! Unfortunately, that doesn't change anything. Still stuck at the 'term% ' prompt.
> 




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] Trying to override 'cd' command
  2015-06-12 21:05   ` Ryan Gonzalez
  2015-06-12 21:35     ` Bakul Shah
  2015-06-12 21:50     ` Anthony Sorace
@ 2015-06-13  8:02     ` Ingo Krabbe
  2015-06-13 17:22       ` Ryan Gonzalez
  2 siblings, 1 reply; 12+ messages in thread
From: Ingo Krabbe @ 2015-06-13  8:02 UTC (permalink / raw)
  To: 9fans

I tried it in a fresh window, where it works for me.

> Thanks for replying! Unfortunately, that doesn't change anything. Still
> stuck at the 'term% ' prompt.
> 
> 
> On Sun, Jun 7, 2015 at 6:43 PM, Ingo Krabbe <ikrabbe.ask@gmail.com> wrote:
> 
>> try it with
>>
>> fn cd{
>>             builtin cd $1
>>             prompt=(`{pwd}^'% ' '    ')
>> }
>>
>> the difference is `{pwd} not '{pwd}.
>>
>>
>>
>> > Coming from a bash world, I really like knowing what directory I'm in at
>> > the prompt. I tried putting this at the end of 'lib/profile':
>> >
>> >
>> >
>> > fn cd{
>> >     builtin cd $1
>> >     prompt=('{pwd}^'% ' '    ')
>> > }
>> >
>> > cd $HOME
>> >
>> >
>> >
>> > However, it doesn't work! The 'cd' command seems to do what it normally
>> > does. The prompt stays at 'term% '. Does nothing.
>> >
>> > --
>> > Ryan
>> > [ERROR]: Your autotools build scripts are 200 lines longer than your
>> > program. Something’s wrong.
>> > http://kirbyfan64.github.io/
>>
>>
>>
> 
> 
> -- 
> Ryan
> [ERROR]: Your autotools build scripts are 200 lines longer than your
> program. Something’s wrong.
> http://kirbyfan64.github.io/





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] Trying to override 'cd' command
  2015-06-13  8:02     ` Ingo Krabbe
@ 2015-06-13 17:22       ` Ryan Gonzalez
  2015-06-13 18:46         ` Ingo Krabbe
  0 siblings, 1 reply; 12+ messages in thread
From: Ryan Gonzalez @ 2015-06-13 17:22 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs, Ingo Krabbe

[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]

I added it to the end of lib/profile.

On June 13, 2015 3:02:56 AM CDT, Ingo Krabbe <ikrabbe.ask@gmail.com> wrote:
>I tried it in a fresh window, where it works for me.
>
>> Thanks for replying! Unfortunately, that doesn't change anything.
>Still
>> stuck at the 'term% ' prompt.
>> 
>> 
>> On Sun, Jun 7, 2015 at 6:43 PM, Ingo Krabbe <ikrabbe.ask@gmail.com>
>wrote:
>> 
>>> try it with
>>>
>>> fn cd{
>>>             builtin cd $1
>>>             prompt=(`{pwd}^'% ' '    ')
>>> }
>>>
>>> the difference is `{pwd} not '{pwd}.
>>>
>>>
>>>
>>> > Coming from a bash world, I really like knowing what directory I'm
>in at
>>> > the prompt. I tried putting this at the end of 'lib/profile':
>>> >
>>> >
>>> >
>>> > fn cd{
>>> >     builtin cd $1
>>> >     prompt=('{pwd}^'% ' '    ')
>>> > }
>>> >
>>> > cd $HOME
>>> >
>>> >
>>> >
>>> > However, it doesn't work! The 'cd' command seems to do what it
>normally
>>> > does. The prompt stays at 'term% '. Does nothing.
>>> >
>>> > --
>>> > Ryan
>>> > [ERROR]: Your autotools build scripts are 200 lines longer than
>your
>>> > program. Something’s wrong.
>>> > http://kirbyfan64.github.io/
>>>
>>>
>>>
>> 
>> 
>> -- 
>> Ryan
>> [ERROR]: Your autotools build scripts are 200 lines longer than your
>> program. Something’s wrong.
>> http://kirbyfan64.github.io/

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

[-- Attachment #2: Type: text/html, Size: 2207 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] Trying to override 'cd' command
  2015-06-13 17:22       ` Ryan Gonzalez
@ 2015-06-13 18:46         ` Ingo Krabbe
  2015-06-27  0:24           ` Ryan Gonzalez
  0 siblings, 1 reply; 12+ messages in thread
From: Ingo Krabbe @ 2015-06-13 18:46 UTC (permalink / raw)
  To: 9fans

try

whatis cd

to test if the function as active at all

btw: I just saw your signature. Great :D

>>> -- 
>>> Ryan
>>> [ERROR]: Your autotools build scripts are 200 lines longer than your
>>> program. Something’s wrong.
>>> http://kirbyfan64.github.io/
> 
> -- 
> Sent from my Android device with K-9 Mail. Please excuse my brevity.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] Trying to override 'cd' command
  2015-06-13 18:46         ` Ingo Krabbe
@ 2015-06-27  0:24           ` Ryan Gonzalez
  2015-06-27 13:34             ` Neven Sajko
  0 siblings, 1 reply; 12+ messages in thread
From: Ryan Gonzalez @ 2015-06-27  0:24 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 805 bytes --]

Finally booted up Plan 9 again. Indeed, the function works when placed in
the shell, but *not in lib/profile*.

I'm putting in $HOME/lib/profile. That's the correct location, right?


On Sat, Jun 13, 2015 at 1:46 PM, Ingo Krabbe <ikrabbe.ask@gmail.com> wrote:

> try
>
> whatis cd
>
> to test if the function as active at all
>
> btw: I just saw your signature. Great :D
>
> >>> --
> >>> Ryan
> >>> [ERROR]: Your autotools build scripts are 200 lines longer than your
> >>> program. Something’s wrong.
> >>> http://kirbyfan64.github.io/
> >
> > --
> > Sent from my Android device with K-9 Mail. Please excuse my brevity.
>
>
>
>


-- 
Ryan
[ERROR]: Your autotools build scripts are 200 lines longer than your
program. Something’s wrong.
http://kirbyfan64.github.io/

[-- Attachment #2: Type: text/html, Size: 1698 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] Trying to override 'cd' command
  2015-06-27  0:24           ` Ryan Gonzalez
@ 2015-06-27 13:34             ` Neven Sajko
  2015-06-27 16:55               ` Ryan Gonzalez
  0 siblings, 1 reply; 12+ messages in thread
From: Neven Sajko @ 2015-06-27 13:34 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

>From the manual:

          -l         If -l is given or the first character of argument
                     zero is -, rc reads commands from
                     $home/lib/profile, if it exists, before reading
                     its normal input.

Does this help you?



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] Trying to override 'cd' command
  2015-06-27 13:34             ` Neven Sajko
@ 2015-06-27 16:55               ` Ryan Gonzalez
  2015-06-27 20:23                 ` Teodoro Santoni
  0 siblings, 1 reply; 12+ messages in thread
From: Ryan Gonzalez @ 2015-06-27 16:55 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs, Neven Sajko

[-- Attachment #1: Type: text/plain, Size: 574 bytes --]

I think so...

So, in order to get my cd command, I enter '-' at the rc prompt? Is there some way for that to happen automatically?

On June 27, 2015 8:34:24 AM CDT, Neven Sajko <nsajko@gmail.com> wrote:
>>From the manual:
>
>          -l         If -l is given or the first character of argument
>                     zero is -, rc reads commands from
>                     $home/lib/profile, if it exists, before reading
>                     its normal input.
>
>Does this help you?

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

[-- Attachment #2: Type: text/html, Size: 875 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] Trying to override 'cd' command
  2015-06-27 16:55               ` Ryan Gonzalez
@ 2015-06-27 20:23                 ` Teodoro Santoni
  0 siblings, 0 replies; 12+ messages in thread
From: Teodoro Santoni @ 2015-06-27 20:23 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Sat, Jun 27, 2015 at 11:55:32AM -0500, Ryan Gonzalez wrote:
> I think so...
>
> So, in order to get my cd command, I enter '-' at the rc prompt? Is there some way for that to happen automatically?
>
> On June 27, 2015 8:34:24 AM CDT, Neven Sajko <nsajko@gmail.com> wrote:
> >From the manual:
> >
> >          -l         If -l is given or the first character of argument
> >                     zero is -, rc reads commands from
> >                     $home/lib/profile, if it exists, before reading
> >                     its normal input.
> >
> >Does this help you?

Good evening,

no. You have to source the file $home/lib/profile by hand or invoke rc from a link called -rc, as rc -l or whatever.

--
Teodoro Santoni

Something is wrong. I don't wanna compile 20 KB of Go code to list files.




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-06-27 20:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-07 23:29 [9fans] Trying to override 'cd' command Ryan Gonzalez
2015-06-07 23:43 ` Ingo Krabbe
2015-06-12 21:05   ` Ryan Gonzalez
2015-06-12 21:35     ` Bakul Shah
2015-06-12 21:50     ` Anthony Sorace
2015-06-13  8:02     ` Ingo Krabbe
2015-06-13 17:22       ` Ryan Gonzalez
2015-06-13 18:46         ` Ingo Krabbe
2015-06-27  0:24           ` Ryan Gonzalez
2015-06-27 13:34             ` Neven Sajko
2015-06-27 16:55               ` Ryan Gonzalez
2015-06-27 20:23                 ` Teodoro Santoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).