Previous Thread
Next Thread
Print Thread
How to set a variable using system command
#37165 09/28/18 09:28 PM
Joined: Sep 2018
Posts: 8
A
Forum Member
OP Offline
Forum Member
A
Joined: Sep 2018
Posts: 8
Hello,

Is there a way to set a variable as result of system command?

For example:
set home = system "echo house"

Checking:
echo @home

Result:
house


Regards.

Re: How to set a variable using system command
Antoniel Gomes #37166 09/29/18 04:26 PM
Joined: Sep 2003
Posts: 8,447
rmv Online Content
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 8,447
Yes, but indirectly through a file:

system "echo house > /tmp/file.txt"
open unit 2 read card name /tmp/file.txt
get home unit 2


Note that any text will become all upper case.


Rick Venable
computational chemist

Re: How to set a variable using system command
rmv #37167 10/01/18 07:07 PM
Joined: Sep 2018
Posts: 8
A
Forum Member
OP Offline
Forum Member
A
Joined: Sep 2018
Posts: 8
Thank you.
I was trying to do that directly in charmm to don't write any file.

Regards.


Moderated by  John Legato, lennart 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 5.6.33-0+deb8u1 Page Time: 0.005s Queries: 20 (0.002s) Memory: 0.9011 MB (Peak: 0.9760 MB) Data Comp: Off Server Time: 2020-05-28 22:55:35 UTC
Valid HTML 5 and Valid CSS