Sponsored Content
Full Discussion: Javascript -> Shell Script
Top Forums Web Development Javascript -> Shell Script Post 302228383 by redoubtable on Sunday 24th of August 2008 07:25:53 AM
Old 08-24-2008
Side note: not all browsers allow you to execute shell commands through javascript (and enabling this is really dangerous). The only way javascript can ask for safe execution is on server-side using ajax -- this is used to make really dynamic pages which don't need page reload to retrieve information.
 

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
GETOPT(3)								 1								 GETOPT(3)

getopt - Gets options from the command line argument list

SYNOPSIS
array getopt (string $options, [array $longopts]) DESCRIPTION
Parses options passed to the script. PARAMETERS
o $options - Each character in this string will be used as option characters and matched against options passed to the script starting with a single hyphen ( -). For example, an option string "x" recognizes an option -x. Only a-z, A-Z and 0-9 are allowed. o $longopts - An array of options. Each element in this array will be used as option strings and matched against options passed to the script starting with two hyphens ( --). For example, an longopts element "opt" recognizes an option --opt. The $options parameter may contain the following elements: oIndividual characters (do not accept values) oCharacters followed by a colon (parameter requires value) oCharacters followed by two colons (optional value) Option values are the first argument after the string. If a value is required, it does not matter whether the value has leading white space or not. See note. Note Optional values do not accept " " (space) as a separator. Note The format for the $options and $longopts is almost the same, the only difference is that $longopts takes an array of options (where each element is the option) whereas $options takes a string (where each character is the option). RETURN VALUES
This function will return an array of option / argument pairs or FALSE on failure. Note The parsing of options will end at the first non-option found, anything that follows is discarded. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | Added support for "=" as argument/value separa- | | | tor. | | | | | 5.3.0 | | | | | | | Added support for optional values (specified | | | with "::"). | | | | | 5.3.0 | | | | | | | Parameter $longopts is available on all systems. | | | | | 5.3.0 | | | | | | | This function is no longer system dependent, and | | | now works on Windows, too. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 getopt(3) example: The basics <?php // Script example.php $options = getopt("f:hp:"); var_dump($options); ?> shell> php example.php -fvalue -h The above example will output: array(2) { ["f"]=> string(5) "value" ["h"]=> bool(false) } Example #2 getopt(3) example: Introducing long options <?php // Script example.php $shortopts = ""; $shortopts .= "f:"; // Required value $shortopts .= "v::"; // Optional value $shortopts .= "abc"; // These options do not accept values $longopts = array( "required:", // Required value "optional::", // Optional value "option", // No value "opt", // No value ); $options = getopt($shortopts, $longopts); var_dump($options); ?> shell> php example.php -f "value for f" -v -a --required value --optional="optional value" --option The above example will output: array(6) { ["f"]=> string(11) "value for f" ["v"]=> bool(false) ["a"]=> bool(false) ["required"]=> string(5) "value" ["optional"]=> string(14) "optional value" ["option"]=> bool(false) } Example #3 getopt(3) example: Passing multiple options as one <?php // Script example.php $options = getopt("abc"); var_dump($options); ?> shell> php example.php -aaac The above example will output: array(2) { ["a"]=> array(3) { [0]=> bool(false) [1]=> bool(false) [2]=> bool(false) } ["c"]=> bool(false) } SEE ALSO
$argv. PHP Documentation Group GETOPT(3)
All times are GMT -4. The time now is 02:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy