Pawel Jakubas asked:
>
> What is your recommended way to call linux command/invoke program
> from J and capture result? Let's say I want to invoke
> *dd if=/dev/urandom bs=100 count=1*

   
    NB. 2!:0 returns stdout, stderr goes to the console
    s =. 2!:0 'dd if=/dev/urandom bs=100 count=1'
1+0 records in
1+0 records out
100 bytes copied, 3.686e-05 s, 2.7 MB/s
   $s
100
   60 list a. i. s
147 199 188 11  245 166 129 112 202 129 68  223 155 220 49  
246 215 76  27  156 172 0   145 231 91  42  33  72  68  163 
57  125 225 209 236 200 157 8   39  216 212 210 88  64  3   
48  13  55  209 142 177 188 124 93  253 114 89  51  7   213 
198 226 153 13  38  102 130 135 201 85  154 238 32  237 143 
88  184 127 165 153 57  33  128 188 232 34  177 254 27  131 
243 66  198 56  79  160 81  163 7   250                     


   ' (' taketo 2!:0 'uname -a'
Linux hubert 5.15.35-1-pve #1 SMP PVE 5.15.35-3

   9!:14''
j901/j64/linux/release-c/commercial/www.jsoftware.com/2020-01-11T10:39:00

                                                        Martin
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to