Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - two-

#1
I have a function run-sh defined as so:(define (run-sh sTr) (exec (format {'%s'} sTr)))run-sh is a kind of basic function that takes input sTr - the shell command.

newLISP can call it like this:(run-sh {ls -a -l})or, so i wish. The problem is this is my error message:sh: ls -a -l: command not foundI know you're probably wondering 'why not use (exec ...?' but, let's say, if I wanted to do this, how can i pass a list of strings to run-sh such that the first string is the command name, and have newLISP pass the remaining strings as the command's arguments?

ยป; }
#2
Thank you, itistoday.
#3
Oh. Thank you ;}.

So, the return value of (exec "pbpaste") is a list (of strings), and in this case the first element of that list is the string "Object.Oriented.Analysis."



Can you have println print without the trailing newline?
#4
i'm using textexpander on mac os x. the result of the following code is no output. nothing.
#!/usr/bin/newlisp
(set 'text (exec "pbpaste"))
(replace {.} text " " 0)


I want to replace every occurance of the period {.} with a space " "...

The following code also produces no output:
#!/usr/bin/env newlisp
(set 'text (string (exec "pbpaste")))
(println (parse (replace {.} text " " 0) ""))


same:
#!/usr/bin/env newlisp
(set 'text (string (exec "pbpaste")))
(set 'text2 (parse (replace {.} text " ") ""))
(println text2)
(exit)

even if i use #!/usr/bin/newlisp in the prologue of the script, i still get nothing



1. yes i can execute newlisp in the shell with either /usr/bin/newlisp or /usr/bin/env newlisp .

2. yes, the textexpander macro definition type is set to shell script.



the result of evaluating the first code block above in newlisp from the shell when i copy the string "Object.Oriented.Analysis." (without double quotes) is:
> (set 'text (exec "pbpaste"))
("Object.Oriented.Analysis.")
> (replace "." text " " 0)
(" ")


the result of evaluating the second code block above in newlisp from the shell when i copy the string "Object.Oriented.Analysis." (without double quotes) is:
> (set 'text (string (exec "pbpaste")))
"("Object.Oriented.Analysis.")"
> (println (parse (replace {.} text " " 0) ""))
("                                    ")
("                                    ")


the result of evaluating the third code block above in newlisp from the shell when i copy the string "Object.Oriented.Analysis." (without double quotes) is:
> (set 'text (string (exec "pbpaste")))
"("Object.Oriented.Analysis.")"
> (set 'text2 (parse (replace {.} text " ") ""))
("("Object Oriented Analysis ")")
> (println text2)
("("Object Oriented Analysis ")")
("("Object Oriented Analysis ")")
^ this seems better, but textexpander produces no output.