Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: aus9 on April 21, 2013, 04:25:52 AM

Title: [SOLVED] cd -- might not be a bug?
Post by: aus9 on April 21, 2013, 04:25:52 AM
Hi

I am reluctant to call it a bug, but I find it equally bugging me so thought I would report it in case its fixable.

I can easily reproduce it.

In terminal I define a variable, lets call it

SRC=cups-1.6.2

If I forget to define it, and its real pathway is  /tmp/cups-1.6.2
and I am currently in /tmp

Code: [Select]
cd $SRC

kicks me back into either home folder for the user

eg for root
Code: [Select]
root@box:/tmp# pwd
/tmp
root@box:/tmp# cd $SRC
root@box:~# pwd
/root

for tc

Code: [Select]
tc@box:/tmp$ pwd
/tmp
tc@box:/tmp$ cd $SRC
tc@box:~$ pwd
/home/tc

I know the primary error is the idiot typing at the moment

###########
FEATURE request
###########
Any chance of some kind of feature request to stop the kick back into the relevant home folder?

thanks for reading
Title: Re: cd -- might be a bug?
Post by: AmatCoder on April 21, 2013, 05:49:48 AM
If $SRC is empty then cd is executed with no arguments. And when cd is executed without arguments the user is returned to the home directory.

It is normal behavior, not bug.
Title: Re: cd -- might be a bug?
Post by: AmatCoder on April 21, 2013, 06:06:23 AM
Any chance of some kind of feature request to stop the kick back into the relevant home folder?

Code: [Select]
$ cd ${SRC?Error}
This gives you an error if $SCR variable is not defined and lets you where you are at.
Title: Re: [SOLVED] cd -- might not be a bug?
Post by: aus9 on April 21, 2013, 07:44:45 AM
AmatCoder


Thanks for the quick reply, I thought that might be the case but doesn't hurt to ask eh?

marked as solved
Title: Re: cd -- might be a bug?
Post by: Lee on April 21, 2013, 11:18:23 AM

Code: [Select]
$ cd ${SRC?Error}
This gives you an error if $SCR variable is not defined and lets you where you are at.

Adding this to my growing IUSILFTF list.  Thank you.

"Incredibly Useful S(tuff) I've Learned From These Forums"