Go Down

Topic: How to invoke cd command from Process.runShellCommand() : Please advise - Thanks (Read 1 time) previous topic - next topic

BREL

[font=Verdana]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




sonnyyu


Jantje

I'm using cd and I'm not aware of problems.
But I am using cd in scripts that start with
Code: [Select]
#!/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

Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

JosAH

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

BREL

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

Go Up