Hey guys, can someone help me with this script...
#!/bin/sh
dir=`pwd`
for i in *.f
do if
then M=`wc -l < ${i}
sed -e 's://.*::' < ${i} | \
(echo "//${i} -"$M ; cat - ) > $i.tmp
chmod 700 $i ; mv ${i}.tmp $i
... (6 Replies)
I keep getting errors messages for the "else" statement at line 81?
#!/bin/ksh
######### Environment Setup #########
PATH=/gers/nurev/menu/pub/sbin:/gers/nurev/menu/pub/bin:/gers/nurev/menu/pub/mac
:/gers/nurev/menu/adm/sbin:/gers/nurev/menu/adm/bin:/gers/nurev/menu/adm/mac:/ge... (8 Replies)
I am trying to create a script but it is giving me errors on Cygwin for the following script. Could someone tell me, what am I doing wrong?
choice=1000
echo "choice is $choice"
while ; do
echo "choice is $choice"
echo 'Please select your option:'
echo '1. Option 1'
echo '2. Option 2'... (3 Replies)
Hi,
I have this example script which gives error ": unexpected operator/operand". I need the '' brackets for operator precedence.
#!/bin/ksh
x="abc"
y="xyz"
z="123"
if -a
then
print "yes"
else
print "no"
fi
Thanks (2 Replies)
Hi
I've made a short script but it is not working. Can some pl. help me out in this?
./123.sh
#! /usr/bin/ksh
# for changing to this directory
cd /layered/relational/scripts
When I run the above scripts, it doesn't change to the above directory. I don't what is the problem? the... (2 Replies)
Please see below mentioned my script ... it ran once without any issue .... then after it is not coming out .... please suggest what is wrong?
#!/bin/ksh
## if (( ${num_errors} > 0 ));
export ACULOG=/home/varshnes/input
export num_errors=10
**** Search for 'Start correcting roll up... (7 Replies)
Hi...
I am fed up in file handing with array for comparing....
1st I want save first 2 columns of file 1
I tried like this,,
{getline< "file1";ln=$1; lt=$2}then I read second file's 1st and 2nd column..and saved like this
and small calculation and initialization
var1 =$1
var2 =$2... (5 Replies)
Dear All
The following is part of my script:
echo ${myarray}
mytitle=`awk '{print substr(${myarray}, 0, length(${myarray})-4)}' /dev/null`
the echo ${myarray} works fine;
however, I keep getting following error for the mytitle=.. part:
awk: line 1: syntax error at or near {
awk: line... (3 Replies)
Hi ! all I am just trying to check range in my datafile
pls tell me why its resulting wrong
admin@IEEE:~/Desktop$ cat test.txt
0 28.4
5 28.4
10 28.4
15 28.5
20 28.5
25 28.6
30 28.6
35 28.7
40 28.7
45 28.7
50 28.8
55 28.8
60 28.8
65 28.1... (2 Replies)
Discussion started by: Akshay Hegde
2 Replies
LEARN ABOUT PHP
getopt
GETOPT(3) 1 GETOPT(3)getopt - Gets options from the command line argument listSYNOPSIS
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)