Sponsored Content
Full Discussion: problem in shell script
Top Forums Shell Programming and Scripting problem in shell script Post 302167700 by gabi on Friday 15th of February 2008 09:21:51 AM
Old 02-15-2008
Try i=$(expr $i + 1)

Instead of i=`expr $i + 1`. I'm new to UNIX, but it might work.

Gabi
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script problem

shell script for sorting,searchingand insertion/deletion of elements in a list (1 Reply)
Discussion started by: jayaram_miryabb
1 Replies

2. UNIX for Dummies Questions & Answers

Shell script problem

Hi, I have a shell script in which I am calling a function from a different shell script. This functions executes the SQL and the results are stored in a log file. If the result of the SQL is "no rows selected" then I need to exit the main shell script. My shell script is executing fine if... (5 Replies)
Discussion started by: shashi_kiran_v
5 Replies

3. Shell Programming and Scripting

Problem in shell script

:confused: Hi, I have written a script which calls a stored procrdure. The Stored procedure has 2 inputs and 6 outputs. I need to capture one of the outputs. But I am not able to get any result from this simple script- ! /bin/ksh echo "connect to dbau user etlbitst using anf1892;" >... (1 Reply)
Discussion started by: arnie_nits
1 Replies

4. Shell Programming and Scripting

call shell script from perl cgi script problem

hi,, i have perl scipt with line : system('./try.sh $t $d $m'); in shell scipt try.sh i have the line: echo $1 its not printing value of $t that i hav passed..y is it so..i am running it from apache web server (2 Replies)
Discussion started by: raksha.s
2 Replies

5. Shell Programming and Scripting

Problem Shell Script

hy, i have a problem with shell script with sybase. if start single command this script working, but if run into file for example select.sh, the script doesn't create output. Can you help me please ??? thank's USER=`cat $SYBASE/.asepwd | cut -d: -f2 | head -1` PWD=`asepwd.sh $USER... (4 Replies)
Discussion started by: Dolcissimo76
4 Replies

6. Shell Programming and Scripting

Shell script problem

Hello. I am trying to make this shell script bellow work on my server wich should take the names in newacc.cvs and add them to the system. For each user the script should ask me to enter a password for the user im adding and then add them to the system, however my current solution do not work atm... (7 Replies)
Discussion started by: ryzzaze
7 Replies

7. AIX

There's problem with shell script...Help me~

Hello, guys... I'm new to IBM AIX server admin. Actuall, I administrate Oracle 10g on it. *SYSTEM INFO - IBM AIX 6 Powerpc - Oracle 10g R2 (10.2.0.4.0 - 64bit) I wrote a script like bellow... DATE='date' cp /oracle/product/10g/network/log/listener_temp.log... (4 Replies)
Discussion started by: daniel han
4 Replies

8. Shell Programming and Scripting

problem in shell script

hi every body this is my first thread in this forum, i hope find a solution for my problem i have to write a script bt i still have some error and i don't know how to correct them $ for i in `seq 500 505`; do ./generateur_tache $i tache$i.txt; nprocs=$i; copt$i=`cat tache$i.txt | ./copt.awk` ;... (10 Replies)
Discussion started by: ordo_ordo
10 Replies

9. Shell Programming and Scripting

Shell script newbie, what is problem with my script?

Hello, Ubuntu server 11.10 can anybody help what is problem with my shell script? #!/bin/bash #script to find out currently logged on user is root or not. if ] then echo "You are super" else echo "You are awesome!" fi When I run script, I get following output ./uid: line 3: I... (4 Replies)
Discussion started by: kaustubh
4 Replies
expr(1) 							   User Commands							   expr(1)

NAME
expr - evaluate arguments as an expression SYNOPSIS
/usr/bin/expr argument... /usr/xpg4/bin/expr argument... /usr/xpg6/bin/expr argument... DESCRIPTION
/usr/bin/expr, /usr/xpg4/bin/expr The expr utility evaluates the expression and writes the result to standard output. The character 0 is written to indicate a zero value and nothing is written to indicate a null string. /usr/xpg6/bin/expr The expr utility evaluates the expression and writes the result to standard output followed by a NEWLINE. If there is no result from expr processing, a NEWLINE is written to standard output. OPERANDS
The argument operand is evaluated as an expression. Terms of the expression must be separated by blanks. Characters special to the shell must be escaped (see sh(1)). Strings containing blanks or other special characters should be quoted. The length of the expression is lim- ited to LINE_MAX (2048 characters). The operators and keywords are listed below. The list is in order of increasing precedence, with equal precedence operators grouped within {} symbols. All of the operators are left-associative. expr | expr Returns the evaluation of the first expr if it is neither NULL nor 0; otherwise, returns the evaluation of the second expr if it is not NULL; otherwise, 0. expr & expr Returns the first expr if neither expr is NULL or 0, otherwise returns 0. expr{ =, >, >=, <, <=, !=} expr Returns the result of an integer comparison if both arguments are integers, otherwise returns the result of a string comparison using the locale-specific coalition sequence. The result of each comparison will be 1 if the specified relationship is TRUE, 0 if the rela- tionship is FALSE. expr { +, - } expr Addition or subtraction of integer-valued arguments. expr { *, /, %} expr Multiplication, division, or remainder of the integer-valued arguments. expr : expr The matching operator : (colon) compares the first argument with the second argument, which must be an internationalized basic regular expression (BRE), except that all patterns are anchored to the beginning of the string. That is, only sequences starting at the first character of a string are matched by the regular expression. See regex(5) and NOTES. Normally, the /usr/bin/expr matching operator returns the number of bytes matched and the /usr/xpg4/bin/expr matching operator returns the number of characters matched (0 on fail- ure). If the second argument contains at least one BRE sub-expression [(...)], the matching operator returns the string corresponding to 1. integer An argument consisting only of an (optional) unary minus followed by digits. string A string argument that cannot be identified as an integer argument or as one of the expression operator symbols. Compatibility Operators (x86 only) The following operators are included for compatibility with INTERACTIVE UNIX System only and are not intended to be used by non- INTERAC- TIVE UNIX System scripts: index string character-list Report the first position in which any one of the bytes in character-list matches a byte in string. length string Return the length (that is, the number of bytes) of string. substr string integer-1 integer-2 Extract the substring of string starting at position integer-1 and of length integer-2 bytes. If integer-1 has a value greater than the number of bytes in string, expr returns a null string. If you try to extract more bytes than there are in string, expr returns all the remaining bytes from string. Results are unspecified if either integer-1 or integer-2 is a negative value. EXAMPLES
Example 1 Adding an integer to a shell variable Add 1 to the shell variable a: example$ a=`expr $a + 1` Example 2 Returning a path name segment The following example emulates basename(1), returning the last segment of the path name $a. For $a equal to either /usr/abc/file or just file, the example returns file. (Watch out for / alone as an argument: expr takes it as the division operator. See NOTES below.) example$ expr $a : '.*/(.*)' | $a Example 3 Using // characters to simplify the expression Here is a better version of the previous example. The addition of the // characters eliminates any ambiguity about the division operator and simplifies the whole expression. example$ expr //$a : '.*/(.*)' /usr/bin/expr Example 4 Returning the number of bytes in a variable example$ expr "$VAR" : '.*' /usr/xpg4/bin/expr Example 5 Returning the number of characters in a variable example$ expr "$VAR" : '.*' ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of expr: LANG, LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, and NLSPATH. EXIT STATUS
As a side effect of expression evaluation, expr returns the following exit values: 0 If the expression is neither NULL nor 0. 1 If the expression is either NULL or 0. 2 For invalid expressions. >2 An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |enabled | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
basename(1), ed(1), sh(1), Intro(3), attributes(5), environ(5), regex(5), standards(5) DIAGNOSTICS
syntax error Operator and operand errors. non-numeric argument Arithmetic is attempted on such a string. NOTES
After argument processing by the shell, expr cannot tell the difference between an operator and an operand except by the value. If $a is an =, the command: example$ expr $a = '=' looks like: example$ expr = = = as the arguments are passed to expr (and they are all taken as the = operator). The following works: example$ expr X$a = X= Regular Expressions Unlike some previous versions, expr uses Internationalized Basic Regular Expressions for all system-provided locales. Internationalized Regular Expressions are explained on the regex(5) manual page. SunOS 5.11 29 Aug 2003 expr(1)
All times are GMT -4. The time now is 06:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy