From: no.top.post on
In article <8blmvcFj49U1(a)mid.individual.net>, "Chris F.A. Johnson" <cfajohnson(a)gmail.com> wrote:

> On 2010-08-01, no.top.post(a)gmail.com wrote:
> > Other one-line scripts do their jobs.
> > Why not this one ?
> >
> > [root(a)localhost eas]# ib ; pwd
> > /home/eas
>
> Why are you playing around using the root account?
>
Because I'm NOT the office-girl.

> > [root(a)localhost eas]# whereis ib
> > ib: /usr/local/bin/ib
> > [root(a)localhost eas]# cat /usr/local/bin/ib
> > cd /mnt/p11
> > [root(a)localhost eas]# pwd
> > /home/eas
> > [root(a)localhost eas]# cd /mnt/p11
> > [root(a)localhost p11]# pwd
> > /mnt/p11
> > [root(a)localhost p11]# ls -l /usr/local/bin/ib
> > -rwxr-xr-x 1 root root 13 Jul 27 14:19 /usr/local/bin/ib*
> > ---------
> > OK, after writing this, I realised the 'cd' only holds while the script
> > is active. So then I tried 'alias'; but it seems to only apply to the
> > originating VT. So what should I do to short-cut various 'cdS'?
>
> In order for a script to affect the current environment it must be
> sourced:
>
> .. ib
>
> Or (bash only):
>
> source ib

OK, but I want ONE key-stroke.

Rahul wrote:
> Write an alias and put it in your .bashrc / .cshrc. Automatically active in
> new shells you open. Need to soourc .bashrc in the current shell.
> Does that work?

OK, I'll try that.
Perhaps it only activated on the next re-boot.

Thanks.

From: Aragorn on
On Monday 02 August 2010 06:12 in comp.os.linux.misc, somebody
identifying as no.top.post(a)gmail.com wrote...

> In article <8blmvcFj49U1(a)mid.individual.net>, "Chris F.A. Johnson"
> <cfajohnson(a)gmail.com> wrote:
>
>> On 2010-08-01, no.top.post(a)gmail.com wrote:
>>
>> > Other one-line scripts do their jobs.
>> > Why not this one ?
>> >
>> > [root(a)localhost eas]# ib ; pwd
>> > /home/eas
>>
>> Why are you playing around using the root account?
>
> Because I'm NOT the office-girl.

Famous last words. <g>

Whatever position you hold at that office, there is no valid reason as
to why you would be using the root account for experimentation, but
then again, it's your machine - or at least, I'm assuming that you have
rightfully obtained the authority over that machine - and so if you
break it, then you get to keep all the pieces. Just don't say we
didn't warn you. :-)

>> > [root(a)localhost eas]# whereis ib
>> > ib: /usr/local/bin/ib
>> > [root(a)localhost eas]# cat /usr/local/bin/ib
>> > cd /mnt/p11
>> > [root(a)localhost eas]# pwd
>> > /home/eas
>> > [root(a)localhost eas]# cd /mnt/p11
>> > [root(a)localhost p11]# pwd
>> > /mnt/p11
>> > [root(a)localhost p11]# ls -l /usr/local/bin/ib
>> > -rwxr-xr-x 1 root root 13 Jul 27 14:19
>> > /usr/local/bin/ib* ---------
>> > OK, after writing this, I realised the 'cd' only holds while the
>> > script is active. So then I tried 'alias'; but it seems to only
>> > apply to the originating VT. So what should I do to short-cut
>> > various 'cdS'?
>>
>> In order for a script to affect the current environment it must be
>> sourced:
>>
>> .. ib
>>
>> Or (bash only):
>>
>> source ib
>
> OK, but I want ONE key-stroke.

. ib

(Note that there is a space between the period and "ib".)

On my Belgian "azerty" keyboard, a period requires two keypresses on the
alphanumeric part - i.e. hold shift and press the "."/";" key - but you
can make that into one keypress by using the numeric keypad's ".".

> Rahul wrote:
>
>> Write an alias and put it in your .bashrc / .cshrc. Automatically
>> active in new shells you open. Need to soourc .bashrc in the current
>> shell. Does that work?
>
> OK, I'll try that.
> Perhaps it only activated on the next re-boot.

What does a reboot have anything to do with it?

No offense, but if you don't know that a script uses its own subshell
unless it is sourced in the current shell, and if you think that you
need to reboot in order for a script to be read, then are you so sure
that you should indeed be playing around in the root account?

--
*Aragorn*
(registered GNU/Linux user #223157)
From: Rahul on
Aragorn <aragorn(a)chatfactory.invalid> wrote in news:i36gn3$lob$2
@news.eternal-september.org:

> No offense, but if you don't know that a script uses its own subshell
> unless it is sourced in the current shell, and if you think that you
> need to reboot in order for a script to be read, then are you so sure
> that you should indeed be playing around in the root account?

I'd look at it the other way. In that case he is probably OK playing around
as root (can't be a super-critical machine). :)

--
Rahul