systask command
systask
command "ls -l %sysfunc(getoption(work))"
status = rc_ls
wait;
%put &=rc_ls; /* RC_LS=0 */
systask
command "touch /cannot/touch/this/file/because/directory/does/not/exist"
status = rc_ls
wait;
%put &=rc_ls; /* RC_LS=1 */
It seems that for redirection to work, the entire command (inclusive redirection) must be enclosed in something like bash -c 'command > dest-file
or alternatively the shell=…
parameter can be used.
%let dest=/tmp/tq84.txt;
%let cmd=echo abc def ghi>&dest;
systask command "&cmd" wait;
systask command "cat &dest" wait;
/* cat: /tmp/tq84.txt: No such file or directory */
systask command "bash -c '&cmd'" wait;
systask command "cat &dest" wait;
/* > abc def thi */
systask command "rm &dest" wait;
systask command "&cmd" wait shell='bash';
systask command "cat &dest" wait;
/* > abc def thi */