Sponsored Content
Full Discussion: Run with argument
Top Forums Shell Programming and Scripting Run with argument Post 302312774 by devtakh on Sunday 3rd of May 2009 10:19:18 AM
Old 05-03-2009
Another way is the enter all the emp nos in a seperte file and read it within the script and prepare the string

Code:
s=""
while read line;
do 
if [ s == "" ]; then 
s="'$line,'" 
else s="$s""'$line'"","
fi; 
done < empno;
str=`echo "$s"|sed -e 's/^/\(/g' -e 's/,$/\)/g'`
echo $str


cheers,
Devaraj Takhellambam
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to find the last argument in a argument line?

How to find the last argument in a argument line? (4 Replies)
Discussion started by: nehagupta2008
4 Replies

2. Shell Programming and Scripting

get positive number n as argument script must calculate the factorial of its argument

Can someone please help me with this SHELL script? I need to create a script that gets a positive number n as an argument. The script must calculate the factorial of its argument. In other words, it must calculate n!=1x2x3x...xn. Note that 0!=1. Here is a start but I have no clue how to... (3 Replies)
Discussion started by: I-1
3 Replies

3. Shell Programming and Scripting

Need to run the script by argument passing

Hi All, I have a question regarding running this script by passing an argument, for example ./ShellParse.sh sun, how do i do that? So i want when i pass argument sun, it shouild execute things inside the for loop. I want to support some other platforms too, so there are more for loops to... (3 Replies)
Discussion started by: asirohi
3 Replies

4. Shell Programming and Scripting

How to use perl to run bash with argument?

Hi All, I want to run a bash script using perl. But they are in the different dir. #! /usr/bin/perl -w use strict; my $root=`pwd`; chomp($root); my $cmd=".$root/testdir/ft_623.sh 3 4 5 6 7"; print $cmd; my @line=`$cmd`; foreach (@line){ print $_; } ft_623.sh (0 Replies)
Discussion started by: Damon sine
0 Replies

5. Shell Programming and Scripting

Cannot compare argument in if statement in csh/grep command if argument starts with “-“

If ($argv == “-debug”) then Echo “in loop” Endif But this is not working. If I modify this code and remove “-“, then it works. Similarly I am getting problem using grep command also Grep “-debug” Filename Can someone please help me on how to resolve these... (1 Reply)
Discussion started by: sarbjit
1 Replies

6. Shell Programming and Scripting

Make script that run with argument if not run from configuration file argument

Hello, Is there any method thorugh which script can take argument if pass otherwise if argument doesn't pass then it takes the argument from the configuration file i.e I am workiing on a script which will run through crontab and the script will chekout the code ,zip and copy to the... (3 Replies)
Discussion started by: rohit22hamirpur
3 Replies

7. Shell Programming and Scripting

how to run an already made script run against a list of ip addresses solaris 8 question

how to run an already developed script run against a list of ip addresses solaris 8 question. the script goes away and check traffic information, for example check_GE-VLANStats-P3 1.1.1.1 and returns the results ok. how do I run this against an ip list? i.e a list of 30 ip addresses (26 Replies)
Discussion started by: llcooljatt
26 Replies

8. UNIX for Advanced & Expert Users

Error:--test: argument expected--Even though i give an argument.

Hi All, I am running the script VBoxManage list vms |sed 's/"//g' | cut -d " " -f1 > har1out.mytxt result=`cat har1out.mytxt | grep $1' echo $result echo $1 { if then echo pass else echo fail fi (2 Replies)
Discussion started by: harsha85
2 Replies

9. Shell Programming and Scripting

Pass argument in script to run specific part in that

Hello Friends, I need you help ! I have a scripts names runsteps.sh which contains command to run bunch of commands for each application you want to install " Oracle " Jboss" etc echo " Which app you want to install Jboss" ? Yes or no? read ans depending on Yes or not it goes inside... (3 Replies)
Discussion started by: saurabh84g
3 Replies

10. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies
XDIFF_STRING_PATCH(3)							 1						     XDIFF_STRING_PATCH(3)

xdiff_string_patch - Patch a string with an unified diff

SYNOPSIS
string xdiff_string_patch (string $str, string $patch, [int $flags], [string &$error]) DESCRIPTION
Patches a $str string with an unified patch in $patch parameter and returns the result. $patch has to be an unified diff created by xdiff_file_diff(3)/xdiff_string_diff(3) function. An optional $flags parameter specifies mode of operation. Any rejected parts of the patch will be stored inside $error variable if it is provided. PARAMETERS
o $str - The original string. o $patch - The unified patch string. It has to be created using xdiff_string_diff(3), xdiff_file_diff(3) functions or compatible tools. o $flags -$flags can be either XDIFF_PATCH_NORMAL (default mode, normal patch) or XDIFF_PATCH_REVERSE (reversed patch). Starting from ver- sion 1.5.0, you can also use binary OR to enable XDIFF_PATCH_IGNORESPACE flag. o $error - If provided then rejected parts are stored inside this variable. RETURN VALUES
Returns the patched string, or FALSE on error. EXAMPLES
Example #1 xdiff_string_patch(3) example The following code applies changes to some article. <?php $old_article = file_get_contents('./old_article.txt'); $diff = $_SERVER['patch']; /* Let's say that someone pasted a patch to html form */ $errors = ''; $new_article = xdiff_string_patch($old_article, $diff, XDIFF_PATCH_NORMAL, $errors); if (is_string($new_article)) { echo "New article: "; echo $new_article; } if (strlen($errors)) { echo "Rejects: "; echo $errors; } ?> SEE ALSO
xdiff_string_diff(3). PHP Documentation Group XDIFF_STRING_PATCH(3)
All times are GMT -4. The time now is 11:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy