Sponsored Content
Top Forums Shell Programming and Scripting Setting a variable in a while loop (.ksh script) Post 302537398 by jimmy75_13 on Friday 8th of July 2011 04:36:14 AM
Old 07-08-2011
Hi Funksen,

Thanks for your prompt reply.
As i undestand it, this command will find the line identified by "uproc_cible" and set the variables : uproc, rep_cible, liste_rep_sources with the values in that line.

stop me if i'm wrong....Smilie

---------- Post updated at 10:36 AM ---------- Previous update was at 10:30 AM ----------

Here is the modification I made following your recommendation :

Code:
IFS="&" ; grep "${uproc_cible}" $file | read  uproc rep_cible liste_rep_sources

echo $uproc
echo $rep_cible

and this is the output:

Code:
+ file=/home/jpassema/purge_/appli
+ IFS=&
+ grep uproc1 /home/jpassema/purge_/appli
+ read uproc rep_cible liste_rep_sources
+ echo

+ echo

perhaps i goofed up the syntax??

Last edited by Franklin52; 07-08-2011 at 02:07 PM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

setting a global variable in script

Hi All, I know to set global variable i can use export .. But take the situation like below .. I want to set a variable in one script and access that in second script i have done like this .. It is not working one.sh #!/usr/bin/ksh echo $RISSHI export RISSHI=1 two.sh... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies

2. Shell Programming and Scripting

using awk in a for loop (getting ksh variable)

Hi, I've tried searching the forums for a case similar to mine but was unsuccessful. This is my first time to use awk so any help would be really appreciated :) I have one file containing data for with the first value in each row being a State Name. I would need to create a separate file... (1 Reply)
Discussion started by: karver
1 Replies

3. Shell Programming and Scripting

setting ksh environmental variable

Hi, I have problem setting up environmental variables. The idea is to start with main.ksh script that will run setting.ksh, and in side of it I'll set up variables. Please take a look at my code, and help me to find my mistake. Thanks, Mila Main.ksh look like this: #!/usr/bin/ksh #... (2 Replies)
Discussion started by: mefquik
2 Replies

4. Shell Programming and Scripting

Setting Variable in TCL to be understood by KSH Shell

Hi , I am having one TCL TK script , I am setting some variables in the GUI TK interface set DI 1 set MODELS_PATH /a/d/path but I want to make ksh shell understand the variables when I am running TK script I tried to do like this set a but it is not working ... (1 Reply)
Discussion started by: kshitij
1 Replies

5. Shell Programming and Scripting

Setting environment variable using shell script

Hi All, I'm trying to write an menu driven program to automate some functions which involve loging to multiple hosts. The hosts can differ for every use, so I thought I would use an config file to get the hostnames. Now I need to set those values in the config file to environment variable to... (6 Replies)
Discussion started by: arun_maffy
6 Replies

6. Shell Programming and Scripting

setting a shell script variable in awk

The following is part of a larger shell script grep -v "Col1" my_test.log | grep -v "-" | awk '$5 == "Y" {print $1}' instead of printing, can I set set $1 to a variable that the rest of the shell script can read? if $5 == Y, I want to call another shell script and pass $1 as a... (2 Replies)
Discussion started by: guessingo
2 Replies

7. Shell Programming and Scripting

Setting a TZ variable in a script

Hello all, I know this must be simple .... but i can't grasp what could be the issue. I'm trying to setup the timezone variable (to the unix command date) according to what i find in a value that i got from parsing the config file. The end result would be setting the log file with this new... (4 Replies)
Discussion started by: maverick72
4 Replies

8. Shell Programming and Scripting

Setting up env variable in ksh

I am facing a very strange issue. I have script in ksh with #!/bin/ksh as shebang. This script has function which sets the env variable before running other functions of the script. by set_up_env() { CONFIG_FILE="/opt/app/tools/deepmarking/latestVersion/script/UploadEnv" if then ... (7 Replies)
Discussion started by: Tuxidow
7 Replies

9. Shell Programming and Scripting

Setting a variable using variables in a loop

Hi, I am having a bit of trouble with the below code: file=/path/to/file for i in 03 06 07 21; do if ; then eval count$i=`grep -c word $file-$i` fi done Totalcount=0 for i in 03 06 07 21; do if ; then echo $count$i variable not exist; else Tcount=`expr $Tcount + $count$i`; fi... (3 Replies)
Discussion started by: brunlea
3 Replies

10. Shell Programming and Scripting

Help with loop in ksh script

Hi, I am new to UNIX. I am working on a script where it takes the input and produces a desired output and it works fine for one instance. Input(One Instance): CREATE TABLE TAB1 ( COL1, COL2 ); CREATE UNIQUE INDEX XPKTAB1 ( COL1 )TAB1; Output: CREATE TABLE TAB1 ( COL1, COL2... (8 Replies)
Discussion started by: varun2327
8 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 01:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy