Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1556 |
|
Package | utility | |
Module | misc | |
Tool | misc |
\*
- \|
,
respectively. This is mainly used on strings that are to be passed
to the shell. In a compromise between speed and completeness, this is
only a subset of all possible significant characters, but it covers
the most commonly problematic cases. There is no escape mechanism to
avoid the filtering. This uses the builtin regex substitution
capabilities of Glish.
string | String | ||
Allowed: | String |
- dms.escapespecial('abc def ghi jkl mno') abc def ghi jkl mno - dms.escapespecial('a#c d*f g(i j)l m|o') a\#c d\*f g\(i j\)l m\|o - + files := shell('ls -1 A*foo') - files A*foo Anotherfoo - + for (f in files) { print shell(spaste('ls -l ',f)) } -rw-rw-r-- 1 dbriggs visitor 5 Dec 19 18:02 A*foo -rw-rw-r-- 1 dbriggs visitor 4 Dec 19 18:16 Anotherfoo -rw-rw-r-- 1 dbriggs visitor 4 Dec 19 18:16 Anotherfoo - + for (f in files) { print shell(spaste('ls -l ',dms.escapespecial(f))) } -rw-rw-r-- 1 dbriggs visitor 5 Dec 19 18:02 A*foo -rw-rw-r-- 1 dbriggs visitor 4 Dec 19 18:16 AnotherfooThe * in the filename, which we don't know about a priori, has confused the shell. This is cured simply by wrapping all unknown strings in dms.escapespecial() before passing them to the shell.