I'm writing a shell script with bash ver 2.05b in linux. My script has a test with 5 arguments like this:
until
do
.....(some codes)
done
but it raise an error:
[: too many arguments
I tried some ways but not ok.
Could you give a way to work around this. Thanks... (4 Replies)
Hello everyone,
I have two types of files in a directory:
*.txt
*.info
I have a perl script that uses these two files as arguments, and produces a result file:
perl myScript.pl abc.txt abc.xml
How can I run this script (in a "for" loop , looping through both types of files)... (4 Replies)
hi all
i am creating a script to ping hosts and then do a nslookup.
So what needs to happen is that i type the script name with an argument eg:
zong (script name) 172.x.x.x (IP)
at the moment i have got it to take on argument, but idealy i would like it to take more than 1 argument. can you... (1 Reply)
How do I prevent the message "too many arguments" to appear when using this script?
name="one two three four five six seven"
if test $name=""
then
echo "Empty variable"
else
echo "Value assigned"
fi
output:
bash: test: too many arguments
Value assigned (2 Replies)
I have a switch statement, and I want to have two options performing the same thing. For example, if $opt matches "-fb" or "--fbase", I want to perform the same operation. How can I include various matches in "case" ?
switch ($opt)
case "-T":
set Atpath = $par
set opt_tpath =... (8 Replies)
Hi all ,
I want to pass contents from a file say f1 as arguments to a sql query which has In statement using a script
example
select * from table_1 where login in ( `cat f1`) ;
will this work or is there any other way to do it. (1 Reply)
Ok hope my vocab is right here, i'm trying to write multiple sets of arguments to another file for example:
I have a script that accepts four arguments and sends them to a another file
$write.sh it then out in
so the file receiver.txt would contain this:
it then out in
what... (2 Replies)
I am developing a script where 3 other scripts are included.
This is a graph related script.
COMPLETE IDEA:
-There are 3 different graph scripts. I would like to create a master graph with all 3 in one.
-User chooses the type of graph
-User is asked to enter the required auguments (... (7 Replies)
I am passing 3 runtime arguments to a shell script
$path crtl1 crtl2
the crtl files contains data(filename|date|count)
filename.txt|02/05/2010|10
The path contains the original data file,the code should fetch (filename|date|count) from original data file and it should match... (7 Replies)
Hi,
I have a problem where i have to hit multiple URL that are stored in a text file (input.txt) and save their output in different text file (output.txt) somewhat like :
cat input.txt
http://192.168.21.20:8080/PPUPS/international?NUmber=917875446856... (3 Replies)
Discussion started by: mukulverma2408
3 Replies
LEARN ABOUT HPUX
test
test(1) General Commands Manual test(1)NAME
test - condition evaluation command
SYNOPSIS
expr
DESCRIPTION
The command evaluates the expression expr and, if its value is True, returns a zero (true) exit status; otherwise, a nonzero (false) exit
status is returned. also returns a nonzero exit status if there are no arguments. The following primitives are used to construct expr:
True if file exists and is readable.
True if file exists and is writable.
True if file exists and is executable.
True if file exists and is a regular file.
True if file exists and is a directory.
True if file exists and is a character special file.
True if file exists and is a block special file.
True if file exists and is a named pipe (fifo).
True if file exists and its set-user-ID bit is set.
True if file exists and its set-group-ID bit is set.
True if file exists and its sticky bit is set.
True if file exists and has a size greater than zero.
True if file exists and is a symbolic link.
True if the open file whose file descriptor number is
fildes (1 by default) is associated with a terminal device.
True if the length of string
s1 is zero.
True if the length of the string
s1 is non-zero.
True if strings
s1 and s2 are identical.
True if strings
s1 and s2 are not identical.
s1 True if s1 is not the null string.
True if the integers
n1 and n2 are algebraically equal. Any of the comparisons and can be used in place of
These primaries can be combined with the following operators:
Unary negation operator.
Binary AND operator.
Binary OR operator
has higher precedence than
Parentheses for grouping.
Note that all the operators and flags are separate arguments to Note also that parentheses are significant to the shell and therefore must
be escaped. All file test operators return success if the argument is a symbolic link that points to a file of the file type being tested.
is interpreted directly by the shell, and therefore does not exist as a separate executable program.
EXTERNAL INFLUENCES
International Code Set Support
Single byte and multibyte character code sets are supported.
EXAMPLES
Exit if there are not two or three arguments:
Create a new file containing the text string if the file does not already exist:
Wait for myfile to become non-readable:
WARNINGS
When the form of this command is used, the matching must be the final argument, and both must be separate arguments from the arguments they
enclose (white space delimiters required.
Parentheses and other special shell metacharacters intended to be handled by test must be escaped or quoted when invoking from a shell.
Avoid such problems when comparing strings by inserting a non-operator character at the beginning of both operands:
This approach does not work with numeric comparisons or the unary operators because it would affect the operand being checked.
AUTHOR
was developed by the University of California, Berkeley and HP.
SEE ALSO find(1), sh-posix(1), sh(1).
STANDARDS CONFORMANCE test(1)