ID:1980995
 
(See the best response by NullQuery.)
Code:
mob/verb/dir2222 ()
shell(" cd /home/doniu ; && ls >> test.txt ")


Hello, i try to use shell, and go to xxx directory, ls it, and save the output. But it don't work, ^ that code, don't give any compile errors but just don't work

Is the DD in trusted mode?
Fixed it
Best response
How did you fix it? The answer may help someone searching this forum in the future.
shell(" cd /home/doniu ; && ls >> test.txt ")
cd /home/doniu && ls
; - it should be never in that code
You don't even need to use two commands.

shell("ls /home/doniu >> test.txt")


Will do the job.
I kind of wonder. If you run shell("cd ...") and then run shell again, will it still be in the same directory or will the second shell just start at "./", the home directory of the server? Never bothered to use cd in shell(). I just did everything through direct paths.
Shell usage isn't persistent. It begins execution in the same directory as the dmb and works from there.