Unix/ Shell scripts


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Unix/ Shell scripts
# 1  
Old 07-31-2009
Data Unix/ Shell scripts


Hi,

I need to develop a function incrementor that increments a given number that is passed as an argument (this should use eval). so, am not able to get much info on eval by googling (perticularly on incrementing).
please if any one can help me out.

thanks in advance
# 2  
Old 07-31-2009
Post whatever you have attempted so far. You are more likely to get assistance if you demonstrate that you have attempted something, and specify which shell etc you require assistance with.

And why the requirement to use eval ? Is this homework ?; Please ensure you have read and comply The UNIX and Linux Forums - Forum Rules
# 3  
Old 08-03-2009
Quote:
Originally Posted by Tytalus
Post whatever you have attempted so far. You are more likely to get assistance if you demonstrate that you have attempted something, and specify which shell etc you require assistance with.

And why the requirement to use eval ? Is this homework ?; Please ensure you have read and comply The UNIX and Linux Forums - Forum Rules
no,its not home work...

actually,..i tried in this way

set 2
echo "$1"
# here n may represent an expr value, in this case i want to display a $ value of n value with incrementation ( some where i require this)
n=1
echo $($n)
please help me out if u know
# 4  
Old 08-05-2009
Geervani,

I do hope this is what you are trying to do?
The var. N specifies the parameter number to display.

#!/bin/ksh
N=2
echo $* |sed "s/ /\n/g" |grep -n "" |grep ^$N: |awk -F ':' '{print $2}'
# 5  
Old 08-09-2009
Something like this? (It's bash which has arithmetics built-in.)
Code:
#!/bin/bash

inc()
{
    echo $(($1+1));
}

n=2
echo $n
n2=$(inc n)
echo $n2


Last edited by Yogesh Sawant; 08-10-2009 at 03:44 AM.. Reason: added code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calling oracle package Unix from shell scripts.

Hi, Can anyone tell me how to call a oracle package from a Unix shell script? I want to pass some input parameters to package and it will return me the output which I want to use further in my shell script. I want to know the way to capture the output values in my shell script. Please send some... (1 Reply)
Discussion started by: anil029
1 Replies

2. Shell Programming and Scripting

SSH - Passing Unix login passwords through shell scripts

Hi All , I need to call a script runscript_B.sh on server A, the runscript_B.sh script locating in server B. The runscript_B.sh in calls another script runscript_A on server A itself. it seend, i need to be connect from Server A to Server B using ssh. I have tryed like this in... (3 Replies)
Discussion started by: koti_rama
3 Replies

3. Shell Programming and Scripting

Shell Scripts for automating server inventory for unix servers

Dear Team, I am very new to shell scripting & and presently monitoring unix boxes I am looking for a shell script which will give me the below output script should contain - hostname,OS Version,CPU details, Physical Memory, Partitions Details, Network Details and Software Installed,... (5 Replies)
Discussion started by: whizkidash
5 Replies

4. UNIX for Advanced & Expert Users

unix shell scripts for running on solaris

am new to programmming any body suggest , how to execute, shell script interactively and like stream line edit (3 Replies)
Discussion started by: srini_ibmadmin
3 Replies

5. AIX

Difference between writing Unix Shell script and AIX Shell Scripts

Hi, Please give me the detailed Differences between writing Unix Shell script and AIX Shell Scripts. Thanks in advance..... (0 Replies)
Discussion started by: haroonec
0 Replies

6. UNIX for Advanced & Expert Users

Connecting to Oracle through unix shell scripts

Hi, Can some one help me in connecting to oracle through unix shell scripts with examples. Regards Narayana Gupta (1 Reply)
Discussion started by: guptan
1 Replies

7. Shell Programming and Scripting

Simulating - unix login + scp via shell scripts

Hi, I am a new guy in this forum, I am trying to do the following stuff and want some inputs I am doing this manually, by using the scp command to copy file from a remote unix machine and entering the password at the password prompt. Like this, scp -p user@machine.com:/tmp/test.sh .... (1 Reply)
Discussion started by: drivewedge
1 Replies

8. UNIX for Dummies Questions & Answers

Learning to write UNIX Shell Scripts

Hi All, I am relatively new to UNIX. I know some basic commands. I am learning to write shell scripts. My first aim is to connect to a Data Base via shell script. Any ideas on this? Any links, docs which will tell me about scripting?? Thanks VEN (1 Reply)
Discussion started by: VENC22
1 Replies

9. Shell Programming and Scripting

Making a SOAP call from within unix shell scripts

Hi guys, Is it possible to make SOAP calls from within Unix shell scripts? I need to access a web service from within UNIX in order to lookup something while I am doing some parsing on a file. Regards, Laud (2 Replies)
Discussion started by: Laud12345
2 Replies

10. Shell Programming and Scripting

Converting Text File into XML using Unix Shell Scripts

Hi everyone, If someone out there could help me out with this problem. I would really appreciate it. I am trying to convert a file into xml format using Unix shell scripts. The file has fields with each field having a certain number of bytes, but the fields are not delimited by anything... (10 Replies)
Discussion started by: Laud12345
10 Replies
Login or Register to Ask a Question