So seems only way I'm going to learn is by asking. In the following and I can tell you that $ENV=384:
In the some.files :
Once again, I know basic scripting if you can call it that
Whats really throwing me off here is the variables in {}
What is that piece of code trying to do exactly? Well, from the info I've given.
This is a different piece I've noticed that leads back to the {}. I'll see a file name, say:
BKFILE=$FTPDIR/$TDG/${ZFILE}.out
And I'll know the value of $FTPDIR and $TDG, but where is it getting the value for ${ZFILE} when it hasnt been defined previously in the script.
Using braces like that just seperates the variable name from the rest of the line.
eg
Produces "someotherthing"
But
Would print nothing as there is no variable called 'THINGotherthing'
In the code you've listed, it looks like it's grep'ing out all the lines containing '384' (or whatever $ENV is set to), then splitting each line into different variables.
In your example:
ELABEL gets 'bgtest'
EENV gets '/usr/384'
EFILE gets 'BL.X1' (or BL.X2 ... a different one each time through the loop)
RFILE gets nothing but if there was an extra word on teh end of any of those lines' it would go into RFILE.
If RFILE exists, it looks for any files starting with that name and deletes them.
If RFILE doesn't exist, it deletes any files starting with EFILE (BL.X1 etc).
Hi...I am trying to make a script like this:
mmc=123
echo "$mmc" > 123.txt
The variable "mmc" has to be declared right on the beginning of the script, so when I open 123.txt, I get:
123
My question is, how can I "echo" '$mmc' into 123.txt, retaining the '$mmc' phrase? Which means when... (10 Replies)
Hi,
I'm trying to replace a string with the contents of a file.. I found the below thread that shows how to do this but is there any way to use a variable as the file name in the nawk command?.. When I try I get an error saying
while read groupsvar
do
... (5 Replies)
Hello,
First post for Newbie as I am stumped. I need to get certain elements for a specific PID from the ps command. I am attempting to pass the value for the PID I want to retrieve the information for as a variable. When the following is run without using a variable, setting a specific PID,... (3 Replies)
I have a variable:
$FILENAME = /XXXX/XXXX/XXXX/file.dat
I want to set another variable that will give me this:
$FILENAME2=filea.dat
So basically i'm chopping up variable $FILENAME.
Not sure cut will do this as i'm looking at different directories so the characther length may be... (2 Replies)
Hi i have two question
1. Yahoo!
In above there are total three words
1.1. www
1.2. yahoo
1.3 com
how can i take all three things in different variable, i dont understand that how to separate dot.
it looks like that
a=www
b=yahoo
c=com
2. i have variable xyz whois value... (7 Replies)
I have been working on a script that executes on a number of different operating systems. As a result I was trying to set a variable or perhaps variable array depending on the OS. I tried the following using eval and such but so far have not had any luck. Is there a way to do something like the... (4 Replies)
Hi, this is probably very easy but, how do I define a variable for more than one line.
For example:
var1='more
than
one
line'
when I call it, I want it to be exactly like this, don't want all the words on the same line. (10 Replies)
hi there,
In my shell script I'm using a variable $ICO to speicfy the type of file that I'm processing e.g. VFR = France.
further in my shell I'm trying to programatically set the sql file thtat I want to run :-
REPORTTXT=/tmp/$ICO3hr.dat
however when I check the value (as below) :-
... (4 Replies)
I have a question about C program for Unix:
Do we have to intialize every variable before we use them in C?
I thought we have to untill I found some programs are not intialize the variable before they were used. (2 Replies)