Sponsored Content
Full Discussion: Shell variables problems
Top Forums Shell Programming and Scripting Shell variables problems Post 302356288 by chipcmc on Friday 25th of September 2009 06:47:50 AM
Old 09-25-2009
Shell variables problems

hi, i need some help, the situation is this

1-file of variable enviroments
DIR1=/tmp
DIR2=otherdir/mydir

2-file of list of files (all the names references whic variables of first point)

${DIR1}/${DIR2}/onefile

Well now i create a shell script whic this content
Code:
              . ./file_of_env
              for file in `cat list_of_files`
              do
                 if [ -f ${file} ]
                 then
                      .....
                  else
                     ......
                  file
              done

Well this not work because the valor of variable "file" is :

${DIR1}/${DIR2}/onefile

but if inside the while i put and echo "$DIR1" then enviorement variable is charge.
What i'm doing wrong?
who can i make for the system make the sustituion of the enviorement variable DIR1 and DIR2?

other probe i make is chage the
. ./file_of_env

and put directly the variable definitios of DIR1 and DIR2 but tthe result is the same.

thanks.

---------- Post updated at 05:47 AM ---------- Previous update was at 04:32 AM ----------

i resolve the problem.
thread can be closed.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

C Shell problems

I am a newbies here and also dummies in csh language. I've been told from my frenz this forum is very useful site for Q&A about UNIX script. Can anyone in here just lead me to learn more about csh language with code example. tq (3 Replies)
Discussion started by: unknown2205
3 Replies

2. UNIX for Dummies Questions & Answers

Problems with sed and flat file variables

Hello All, It has been a loooooooooooong time since I had last used sed but decided to use it for a simple task I have . My goal is to use sed to read variables from a flat file then use those same variables in order to make some subsitutions. However what I am finding is that when the... (1 Reply)
Discussion started by: icalderus
1 Replies

3. Shell Programming and Scripting

Shell script problems to do

Does anyone know a good site to do shell script problems? (0 Replies)
Discussion started by: cleansing_flame
0 Replies

4. Shell Programming and Scripting

problems calling out variables in a loop

good afternoon forums. i have a problem that ive been trying to work out all morning and cant seem to get my head around it. what i have in my script is individual letters saved in different variables. so if the word unix was saved then 'u' would be stored in the variable 'wvar1' 'n' in 'wvar2'... (7 Replies)
Discussion started by: strasner
7 Replies

5. UNIX for Dummies Questions & Answers

Problems in shell

hiiii this is the first time for me here >>> but really i have some problems for answers these things also understanding... Can any one help me? Write a simple shell as given in class. Your shell, called shell will read input lines from standard input, parse them into a... (3 Replies)
Discussion started by: Ronald kabbi
3 Replies

6. Shell Programming and Scripting

Problems with expect and set variables

I'm writing a script that'll send a time-stamp to my backup server. I create a file with the name of the current date, send it to my server with scp and rm the file from the local computer. Individually these commands work fine and with a set name the expect scripts also work fine. The problem... (0 Replies)
Discussion started by: Ktesh564
0 Replies

7. Shell Programming and Scripting

Two problems when I am writing my own shell

Hi, guys: I am writing my own shell using c. I meet with two problems. First, when I use tcsetpgrp system call to move a background job to foreground, when this job finishes, my shell program also exit. What is the problem for that? Second, when I use signal , if the child has its own... (1 Reply)
Discussion started by: tomlee
1 Replies

8. Shell Programming and Scripting

Problems with variables syntax

Hi there I am really struggling :eek: to place a value in a variable with the following loop, having run out of ideas please can someone point me in the right direction? We first read two PIDs of a program (say calc) into an array, then we loop reading the details of those processes into a... (6 Replies)
Discussion started by: nathan.harris
6 Replies

9. Shell Programming and Scripting

Problems with substitution between two variables

To all geeks, What I want to achieve: 1. Accept two filenames from user and store the filenames in two variables (FILE1 and FILE2) 2. Check if files exisits. If doesn't, then exit 3. If files exist, look for a particular string in both files 4. If the string exists, then change the... (8 Replies)
Discussion started by: Deepak Tulsani
8 Replies

10. Shell Programming and Scripting

Problems with awk (fatal error) and paste (two variables into one column-by-column)

Hello, I have a script extracting columns of useful numbers from a data file, and manipulating the numbers with awk commands. I have problems with my script... 1. There are two lines assigning numbers to $BaseForAveraging. If I use the commented line (the first one) and let the second one... (9 Replies)
Discussion started by: vgbraymond
9 Replies
CPANPLUS::Shell(3)					User Contributed Perl Documentation					CPANPLUS::Shell(3)

NAME
CPANPLUS::Shell - base class for CPANPLUS shells SYNOPSIS
use CPANPLUS::Shell; # load the shell indicated by your # config -- defaults to # CPANPLUS::Shell::Default use CPANPLUS::Shell qw[Classic] # load CPANPLUS::Shell::Classic; my $ui = CPANPLUS::Shell->new(); my $name = $ui->which; # Find out what shell you loaded $ui->shell; # run the ui shell DESCRIPTION
This module is the generic loading (and base class) for all "CPANPLUS" shells. Through this module you can load any installed "CPANPLUS" shell. Just about all the functionality is provided by the shell that you have loaded, and not by this class (which merely functions as a generic loading class), so please consult the documentation of your shell of choice. BUG REPORTS
Please report bugs or other issues to <bug-cpanplus@rt.cpan.org<gt>. AUTHOR
This module by Jos Boumans <kane@cpan.org>. COPYRIGHT
The CPAN++ interface (of which this module is a part of) is copyright (c) 2001 - 2007, Jos Boumans <kane@cpan.org>. All rights reserved. This library is free software; you may redistribute and/or modify it under the same terms as Perl itself. SEE ALSO
CPANPLUS::Shell::Default, CPANPLUS::Shell::Classic, cpanp perl v5.16.3 2013-05-20 CPANPLUS::Shell(3)
All times are GMT -4. The time now is 02:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy