How to invoke cd command from Process.runShellCommand() : Please advise - Thanks

Hi all,

Since, cd ( Change Directory) is a shell built-in command, Process.runShellCommand("cd /root/file") fails.

How to invoke cd or any other change of directory command to change to the perticular directory in Linix/Linino from the sketch using Process.

From the sketch, I need to navigate to some directory in Linix/Linino and carry out some Linix command operations.

Any advise or pointers is greatly appreciated.

Regards

BREL

Normally use absolute path instead of cd to parent directory.

I'm using cd and I'm not aware of problems.
But I am using cd in scripts that start with

#!/bin/ash

I strongly advice to separate linux code from arduino code. This means write a script that does all the linux actions and only run the script from arduino.

Best regards
Jantje

If 'cd' is a built-in process, it does change the current working directory, but as soon as the sub-process finiishes (after 'cd' has completed in your example) you are back where the parent process was. Write small shell script instead and do everything you have to do after cd-ing to the wanted directory. Run the script.

kind regards,

Jos

Sonnyyu, Jantje, and JosAH,

Thank you very much-for all the replies.

This helped,

I designed the python script and called through the Process with global path reference.
Also added/removed the path to system path
This worked.

Best Regards

BREL