Sponsored Content
Full Discussion: Javascript -> Shell Script
Top Forums Web Development Javascript -> Shell Script Post 302226916 by mark007 on Wednesday 20th of August 2008 06:52:11 AM
Old 08-20-2008
Javascript -> Shell Script

Hi all,

I am trying to call a shell script from a javascript function. This works fine and the shell script returns everything I expected BUT I cannot figure out how to pass command line arguments to this shell script.

Using GET, I assume the url being called needs to be one string with no spaces (hence i cannot do url="myScript.sh arg1 arg2 arg3"

Using POST, I am sending the post variables like this

var args="a=b";
req.open("POST", url, true);
req.send(args);

but do not know how to read those from within my shell script.

Anyone know how to do it? TYVM!
This User Gave Thanks to mark007 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Javascript: Edit a script ?

Hi, i got this script but when i hit reset i loose the times in the form box. Can someone please edit this script so when i hit reset i dont loose the times in the form box's and also have a button to reset everything, including the form boxs <script language="javascript"> // stopwatch... (1 Reply)
Discussion started by: perleo
1 Replies

2. Shell Programming and Scripting

Calling Shell script in javascript

All I want to call a KORN shell script inside a javascript. Is it possible ? Please help me to do this. I want to return or read from shell script in javascript. Thanx in advance Regards Deepak Xavier (1 Reply)
Discussion started by: DeepakXavier
1 Replies

3. Shell Programming and Scripting

How to use ssh execute other shell script on other host (shell script include nohup)?

i want use ssh on the host01 to execute autoexec.sh on the host02 like following : host01> ssh host02 autoexec.sh autoexec.sh include nohup command like follwing : nohup /home/jack/deletedata.sh & after i execute ssh host02 autoexec.sh one the host01. i can't found deletedata.sh... (1 Reply)
Discussion started by: orablue
1 Replies

4. Web Development

Why using this kind of format in Web Development <script type="text/javascript"><!-- ...//--></scrip

I am just wondering why do programmers are using this when programming the web? When you making a joomla templates and the more focus in your mind is to target the search engines then java is very important.Not to use that. (2 Replies)
Discussion started by: Anna Hussie
2 Replies

5. Shell Programming and Scripting

want to use javascript as shell script

<html> <head> <title>Weather & Aviation Page - METAR decoder</title> <meta name="Title" content="Weather & Aviation Page - METAR decoder"> <meta name="Keywords" content="METAR decoder"> <meta name="Publisher" content="SkyStef"> <meta name="Description" content="SkyStefs weather and aviation... (4 Replies)
Discussion started by: anuajay1988
4 Replies

6. Shell Programming and Scripting

How to use javascript code in unix shell?

Hi Need help...I have wrritten one code for html through shell scripting in that i am using java scripts to validate some condition and open the html page without clicking the button.... Code Details echo "<script type="text/javascript">" echo "function exec_refresh()" echo "{" ... (4 Replies)
Discussion started by: l_gshankar24
4 Replies

7. Shell Programming and Scripting

Unable to pass shell script variable to awk command in same shell script

I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist. diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk... (2 Replies)
Discussion started by: Ashunayak
2 Replies

8. Web Development

Javascript to check field is empty then execute rest of script

I have found this bit of code that nearly does what I want. Basically 3 input fields, I want to copy t2 to t3 as it's typed but only if t1 contains data AND t3 is empty: <input type="text" id="t1" /> <input type="text" id="t2" /> <input type="text" id="t3" /> <script> var t2 =... (4 Replies)
Discussion started by: barrydocks
4 Replies

9. Shell Programming and Scripting

How to write config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

10. Shell Programming and Scripting

How to use JavaScript in UNIX Shell scripting?

I want to navigate through a webpage and save that page in my system local automatically. How can I do that by using JavaScript in a Unix shell script. Any suggestions are welcome! (3 Replies)
Discussion started by: abhi3093
3 Replies
RHINO(1)						      General Commands Manual							  RHINO(1)

NAME
rhino - invokes the JavaScript shell for running scripts in batch mode or interactive SYNOPSIS
rhino [options] script_filename_or_url [script_arguments] DESCRIPTION
This manual page documents briefly the rhino command. rhino is a start script for the rhino JavaScript shell which provides a simple way to run scripts in batch mode or an interactive environ- ment for exploratory programming. OPTIONS
-e script_source Executes script_source as a JavaScript script. -f script_filename_or_url Reads script_filename_or_url content and execute it as a JavaScript script. -opt, -O optLevel Optimizes at level optLevel, which must be an integer between 0 and 9. -version versionNumber Specifies the language version to compile with. The string versionNumber must be one of 100, 110, 120, 130, or 140. See JavaScript Language Versions for more information on language versions. PREDEFINED PROPERTIES
Scripts executing in the shell have access to some additional properties of the top-level object. arguments The arguments object is an array containing the strings of all the arguments given at the command line when the shell was invoked. help() Executing the help function will print usage and help messages. defineClass(className) Define an extension using the Java class named with the string argument className. Uses ScriptableObject.defineClass() to define the extension. deserialize(filename) Restore from the specified file an object previously written by a call to serialize. load([filename,...]) Load JavaScript source files named by string arguments. If multiple arguments are given, each file is read in and executed in turn. loadClass(className) Load and execute the class named by the string argument className. The class must be a class that implements the Script interface, as will any script compiled by jsc. print([expr...]) Evaluate and print expressions. Evaluates each expression, converts the result to a string, and prints it. readFile(path[,characterCoding]) Read given file and convert its bytes to a string using the specified character coding or default character coding if explicit cod- ing argument is not given. readUrl(url[,characterCoding]) Open an input connection to the given string url, read all its bytes and convert them to a string using the specified character cod- ing or default character coding if explicit coding argument is not given. runCommand(commandName,[arg,...][options]) Execute the specified command with the given argument and options as a separate process and return the exit status of the process. For details, see JavaDoc for org.mozilla.javascript.tools.shell.Global#runCommand. serialize(object,filename) Serialize the given object to the specified file. spawn(functionOrScript) Run the given function or script in a different thread. sync(function) creates a synchronized function (in the sense of a Java synchronized method) from an existing function. The new function synchro- nizes on the this object of its invocation. quit() Quit shell. The shell will also quit in interactive mode if an end-of-file character is typed at the prompt. version([number]) Get or set JavaScript version number. If no argument is supplied, the current version number is returned. If an argument is sup- plied, it is expected to be one of 100, 110, 120, 130, or 140 to indicate JavaScript version 1.0, 1.1, 1.2, 1.3, or 1.4 respec- tively. SEE ALSO
The online documentation under http://www.mozilla.org/rhino/shell.html <http://www.mozilla.org/rhino/shell.html> AUTHOR
This manual page was written by Wolfgang Baer <WBaer@gmx.de>. February 12, 2005 RHINO(1)
All times are GMT -4. The time now is 07:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy