website: fix js console --exec commands (#29666)

pull/29712/head
Daniel Ramírez-Chiquillo 5 months ago committed by GitHub
parent 1c4860424c
commit 93cdac2bb5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      docs/interacting-with-geth/javascript-console.md

@ -110,19 +110,19 @@ It is also possible to execute JavaScript code non-interactively by passing the
For example, to display the accounts in the keystore: For example, to display the accounts in the keystore:
```sh ```sh
geth attach --exec eth.accounts geth --exec eth.accounts attach
``` ```
```sh ```sh
geth attach --exec eth.blockNumber geth --exec eth.blockNumber attach
``` ```
The same syntax can be used to execute a local script file with more complex statements on a remote node over http, for example: The same syntax can be used to execute a local script file with more complex statements on a remote node over http, for example:
```sh ```sh
geth attach http://geth.example.org:8545 --exec 'loadScript("/tmp/checkbalances.js")' geth --exec 'loadScript("/tmp/checkbalances.js")' attach http://geth.example.org:8545
geth attach http://geth.example.org:8545 --jspath "/tmp" --exec 'loadScript("checkbalances.js")' geth --jspath "/tmp" --exec 'loadScript("checkbalances.js")' attach http://geth.example.org:8545
``` ```
The `--jspath` flag is used to set a library directory for the Javascript scripts. Any parameters passed to `loadScript()` that do not explicitly define an absolute path will be interpreted relative to the `jspath` directory. The `--jspath` flag is used to set a library directory for the Javascript scripts. Any parameters passed to `loadScript()` that do not explicitly define an absolute path will be interpreted relative to the `jspath` directory.

Loading…
Cancel
Save