Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - how to implement command "cd": (5 Items)
   
how to implement command "cd"  
Hi QNX,

       qnx sdp 6.6,
       BSP_ti-am335x-beaglebone_br-660_be-660_SVN797070_JBN574.zip
       beaglebone black Rev. C
       QT 5.3.1

I implemented a QT program similar to https://evileg.com/en/post/261/

input filesystem command such as "ls", which will list the files under current directory. and "pwd" will show the 
current directory path.

However, I am not able to change directory with command "cd".

"ls" / "pwd" and lots of other commands are available @ /opt/qnx660/target/qnx6/armle-v7/bin, however there is no "cd".

Please advise, thanks in advance.

Mike


Re: how to implement command "cd"  
'cd' is a shell builtin.

think about it: "cd" changes the shell's current (working) directory. Since every process has its own current directory,
 it'd be useless if it were a seperate binary, as it would only change its own directory, not that of the calling shell.


HTH

On Fri, 2019-03-08 at 00:56 -0500, mike scott wrote:

Hi QNX,

       qnx sdp 6.6,
       BSP_ti-am335x-beaglebone_br-660_be-660_SVN797070_JBN574.zip
       beaglebone black Rev. C
       QT 5.3.1

I implemented a QT program similar to https://evileg.com/en/post/261/

input filesystem command such as "ls", which will list the files under current directory. and "pwd" will show the 
current directory path.

However, I am not able to change directory with command "cd".

"ls" / "pwd" and lots of other commands are available @ /opt/qnx660/target/qnx6/armle-v7/bin, however there is no "cd".

Please advise, thanks in advance.

Mike






_______________________________________________

OSTech
http://community.qnx.com/sf/go/post119567
To cancel your subscription to this discussion, please e-mail ostech-core_os-unsubscribe@community.qnx.com<mailto:ostech
-core_os-unsubscribe@community.qnx.com>;

Attachment: HTML sf-attachment-mime37568 1.73 KB
Re: how to implement command "cd"  
... or a builtin of whatever tool you're building. look up 'chdir'.

On Fri, 2019-03-08 at 06:59 +0100, Michael Schuster wrote:
'cd' is a shell builtin.

think about it: "cd" changes the shell's current (working) directory. Since every process has its own current directory,
 it'd be useless if it were a seperate binary, as it would only change its own directory, not that of the calling shell.


HTH

On Fri, 2019-03-08 at 00:56 -0500, mike scott wrote:

Hi QNX,

       qnx sdp 6.6,
       BSP_ti-am335x-beaglebone_br-660_be-660_SVN797070_JBN574.zip
       beaglebone black Rev. C
       QT 5.3.1

I implemented a QT program similar to https://evileg.com/en/post/261/

input filesystem command such as "ls", which will list the files under current directory. and "pwd" will show the 
current directory path.

However, I am not able to change directory with command "cd".

"ls" / "pwd" and lots of other commands are available @ /opt/qnx660/target/qnx6/armle-v7/bin, however there is no "cd".

Please advise, thanks in advance.

Mike






_______________________________________________

OSTech
http://community.qnx.com/sf/go/post119567
To cancel your subscription to this discussion, please e-mail ostech-core_os-unsubscribe@community.qnx.com<mailto:ostech
-core_os-unsubscribe@community.qnx.com>;

Attachment: HTML sf-attachment-mime37571 1.94 KB
Re: how to implement command "cd"  
Hi Michael Schuster,

Thank you for the quick reply.

Then is there anyway I can bring the shell environment into this QT program, in which then I am able to use "cd" to 
change directories?

Please advise, thanks in advance

Mike
RE: how to implement command "cd"  
This is not a QNX question.
Just call chdir() in your porgram.

--Elad
________________________________________
From: mike scott [community-noreply@qnx.com]
Sent: March-08-19 1:07 AM
To: ostech-core_os
Subject: Re: how to implement command "cd"

Hi Michael Schuster,

Thank you for the quick reply.

Then is there anyway I can bring the shell environment into this QT program, in which then I am able to use "cd" to 
change directories?

Please advise, thanks in advance

Mike



_______________________________________________

OSTech
http://community.qnx.com/sf/go/post119570
To cancel your subscription to this discussion, please e-mail ostech-core_os-unsubscribe@community.qnx.com