10-10-2017
The first thing I would usually do here is echo the variables before the test (before the if), and do some sanitation on them. I would also declare each variable on its own line, and quote them when using them.
10 More Discussions You Might Find Interesting
1. Programming
Please delete this thread. (0 Replies)
Discussion started by: jxh461
0 Replies
2. Shell Programming and Scripting
Hi,
I have a function in shell script
fun1{ echo "No.of arguments are..."}
this function will be called in same script by passing arguments
fun 1 2 3
I want to check the no. of arguments passed to fun1 function in the same functionbefore validation.
can any one suggest me. (2 Replies)
Discussion started by: KiranKumarKarre
2 Replies
3. Programming
#include <pthread.h>
#include <signal.h>
...
sigset_t mask;
int err,signo;
err=sigwait(&mask,&signo);
switch(signo){
case SIGINT:
...
}
when I compile above code under solaris 10,it raise following error:
error: too many arguments to function 'sigwait'
I look up signal... (4 Replies)
Discussion started by: konvalo
4 Replies
4. Shell Programming and Scripting
Hi,
I've a logging function in bourne shell, flog() which logs the first argument passed to it. How can I pass arguments to this function from a file, like
cat filename | sed '...filtering...' | flog
or
cat filename | sed '...filtering...' | xargs flog
Which did not work, after which... (3 Replies)
Discussion started by: Random_Net
3 Replies
5. UNIX for Advanced & Expert Users
Hi Guys,
I am trying to pass arguments to the script i am wrinting.
When no argument is passed or wrong argument is passed, the script needs to output the way it needs to be called and exit.
Currently, when no arguments is passed, it is not getting exited but goes on assuming those... (3 Replies)
Discussion started by: mac4rfree
3 Replies
6. Shell Programming and Scripting
I have trouble getting this logic to work
#!/bin/bash
function assign_var(){
while
do
read -p "$2 :" $3
done
}
assign_var '$IPADDRESS' ipaddress IPADDRESS
Basicly, i want to make sure that entry is made (i can add more sophisticated checks later), but the idea is to recycle... (11 Replies)
Discussion started by: serverchief
11 Replies
7. Shell Programming and Scripting
I need to call a function within a code with $database and $ service as the arguments How do I proceed ? and how would a function be defined and these two arguments would be used inside the function?
calc_pref_avail $database $service
Best regards,
Vishal (7 Replies)
Discussion started by: Vishal_dba
7 Replies
8. UNIX for Dummies Questions & Answers
Hello Everyone,
Is there a way i can pass the arguments as parameters or variables instead of positional arguments to a function, below i am calling the function defined in a script.
Call:
notify "Error While Generating The List File: ${GEN_PARAM_LIST9} For Feed Data Validation Errors In... (1 Reply)
Discussion started by: Ariean
1 Replies
9. Shell Programming and Scripting
Hey guys,
I'm fairly new to bash scripting, so bear with me :)
What I want to achieve is reading a file (.php), find the phrase 'WACHTWOORD' (password) in it, and collect the password and a part of the filename in a list.
The filename is always 'settings_{name}.php' and the part I'm looking... (6 Replies)
Discussion started by: Eggie01
6 Replies
10. Shell Programming and Scripting
I have a script that uses 2 arguments. I want to call the function part within this script using these same arguments. Below is what I came up with below script so far, any guidance would be helpful. Thank you!
cat backup.sh
#!/bin/bash
function usage {
echo "USAGE: $(basename $0)... (6 Replies)
Discussion started by: mbak
6 Replies
pnmcut(1) General Commands Manual pnmcut(1)
NAME
pnmcut - cut a rectangle out of a portable anymap
SYNOPSIS
pnmcut [-left leftcol] [-right rightcol] [-top toprow] [-bottom bottomrow] [-width width] [-height height] [-pad] [-verbose] [ left top
width height ] [pnmfile]
All options may be abbreviated to the shortest unique prefix.
DESCRIPTION
Reads a PBM, PGM, or PPM image as input. Extracts the specified rectangle, and produces the same kind of image as output.
There are two ways to specify the rectangle to cut: arguments and options. Options are easier to remember and read, more expressive, and
allow you to use defaults. Arguments were the only way available before July 2000.
If you use both options and arguments, the two specifications get mixed in an unspecified way.
To use options, just code any mixture of the -left, -right, -top, -bottom, -width, and -height options. What you don't specify defaults.
It is an error to overspecify, i.e. to specify all three of -left, -right, and -width or -top, -bottom, and -height.
To use arguments, specify all four of the left, top, width, and height arguments. left and top have the same effect as specifying them as
the argument of a -left or -top option, respectively. width and height have the same effect as specifying them as the argument of a -width
or -height option, respectively, where they are positive. Where they are not positive, they have the same effect as specifying one less
than the value as the argument to a -right or -bottom option, respectively. (E.g. width = 0 makes the cut go all the way to the right
edge). Before July 2000, negative numbers were not allowed for width and height.
Input is from Standard Input if you don't specify the input file pnmfile.
Output is to Standard Output.
OPTIONS
-left The column number of the leftmost column to be in the output. If a nonnegative number, it refers to columns numbered from 0 at the
left, increasing to the right. If negative, it refers to columns numbered -1 at the right, decreasing to the left.
-right The column number of the rightmost column to be in the output, numbered the same as for -left.
-top The row number of the topmost row to be in the output. If a nonnegative number it refers to rows numbered from 0 at the top,
increasing downward. If negative, it refers to columns numbered -1 at the bottom, decreasing upward.
-bottom
The row number of the bottom-most row to be in the output, numbered the same as for -top.
-width The number of columns to be in the output. Must be positive.
-height
The number of rows to be in the output. Must be positive.
-pad If the rectangle you specify is not entirely within the input image, pnmcut fails unless you also specify -pad. In that case, it
pads the output with black up to the edges you specify. You can use this option if you need to have an image of certain dimensions
and have an image of arbitrary dimensions.
pnmpad can also fill an image out to a specified dimension, and gives you more explicit control over the padding.
-verbose
Print information about the processing to Standard Error.
SEE ALSO
pnmcrop(1), pnmpad(1), pnmcat(1), pgmslice(1), pnm(5)
AUTHOR
Copyright (C) 1989 by Jef Poskanzer.
29 June 2000 pnmcut(1)