Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Setting a variable (need syntax help) Post 302075020 by Slanter on Monday 29th of May 2006 01:25:15 PM
Old 05-29-2006
Setting a variable (need syntax help)

I need some syntax help (working in a bash shell)

I have a variable which is a filename with an extension, and I need to create another variable with the same name but a different extension

To explain, the input file should be called something like "filename.L1" and the output file should be "filename.GEO"

so here's what I've been typing, but it doesn't work:

input=filename.L1
output=echo $input | sed s/L1/GEO/g


can anybody tell me how I should do this?

-Brent.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

setting CC variable

I am trying to install GCC-3.1.1 on an SGI Indigo2. I already have MIPSpro 7.2.1 installed. However, when I try to configure GCC-3.1.1, I get the message "cc ERROR: cc -o conftest -g failed, You must set the environment variable CC to a working compiler." What is the name of the MIPSpro c++... (1 Reply)
Discussion started by: mdbanas
1 Replies

2. Programming

setting CC variable

I am trying to install GCC-3.1.1 on an SGI Indigo2. I already have MIPSpro 7.2.1 installed. However, when I try to configure GCC-3.1.1, I get the message "cc ERROR: cc -o conftest -g failed, You must set the environment variable CC to a working compiler." What is the name of the MIPSpro c++... (1 Reply)
Discussion started by: mdbanas
1 Replies

3. UNIX for Dummies Questions & Answers

Setting a variable

I want to set a variable to be any number of dashes. Rather than doing the following: MYVAR="------------------" I'd like to be able to set the variable to, say, 80 dashes but don't want to have to count 80 dashes. Is there a way to do this? (2 Replies)
Discussion started by: photh
2 Replies

4. Shell Programming and Scripting

Syntax to export any variable

How to export variables on a UNIX prompt. Please provide me syntax. Thanks in advance. Malay (5 Replies)
Discussion started by: malaymaru
5 Replies

5. Shell Programming and Scripting

Variable setting help please

L=0 cat test.sh | while read line do L='expr $1 + 1' echo $L done echo $l >>> the echo $L at the end produces 0 but i actually want it to produce the number of lines - any idea why this is happening? (16 Replies)
Discussion started by: penfold
16 Replies

6. Shell Programming and Scripting

Setting variable

How do you set a varible with information that contains a string and also another variable? For example: subject="Attention: $name / This $type needs your attention" The $xxxx are of course other variables that I instantiated earlier. Is it like Java where you have to use double quotes and... (1 Reply)
Discussion started by: briskbaby
1 Replies

7. UNIX for Dummies Questions & Answers

setting a variable

In my script, I have the following command.... du -sk `ls -ltd sales12|awk '{print $11}'`|awk '{print $1}' it returns the value 383283 I want to modify my script to capture that value into a variable. So, I try doing the following... var1=`du -sk `ls -ltd sales12|awk '{print... (5 Replies)
Discussion started by: tumblez
5 Replies

8. Shell Programming and Scripting

Help with setting a variable!

I am working within a while loop and i am trying to set a variable that will read out each count of the files. the problem is the count variable i have set up gives me a total and not the individual count of each file. in the data area there is 4 abc.dat and 1 def.dat. how can i do this??? ... (2 Replies)
Discussion started by: Pablo_beezo
2 Replies

9. UNIX for Dummies Questions & Answers

Setting shell variables with ":" syntax

I nedd help on the below highlited one. can any one explain on this,How its work in shell scripting.. then that will be very great full... L_ABCD=${L_DBG:=N} Thanks Muddasas (3 Replies)
Discussion started by: muddasani
3 Replies

10. Shell Programming and Scripting

Variable syntax error in $?

hi all , i just tried to take the status of previous command inside the script using echo $?. It throws me a variable syntax error , but when i use echo $? as an individual command it works perfectly . can anyone Please tell me why am getting a variable syntax error when i use echo $?... (7 Replies)
Discussion started by: Rahul619
7 Replies
cd(1)							      General Commands Manual							     cd(1)

NAME
cd - Changes the current working directory SYNOPSIS
cd [directory] Note The C shell has a built-in version of the cd command. If you are using the C shell, and want to guarantee that you are using the command described here, you must specify the full path /usr/bin/cd. See the csh(1) reference page for a description of the built-in command. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: cd: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
None OPERANDS
The pathname (either full or relative) to be used as the new working directory. If (hyphen) is specified as the directory, the cd command changes your current (working) directory to the directory name saved in the environment variable OLDPWD. DESCRIPTION
The cd command moves you from your present directory to another directory. You must have execute (search) permission in the specified directory. If you do not specify a directory, cd moves you to your login directory ($HOME in ksh and sh environments, or $home in csh environment). If the specified directory name is a full pathname, it becomes the current working directory. A full pathname begins with a / (slash) for the root directory, with a . (dot) for the current working directory, or with a .. (dot dot) for the parent directory. If the directory name is not a full pathname, cd searches for it relative to one of the paths specified by the $CDPATH shell variable (or $cdpath csh vari- able). This variable has the same syntax as, and similar semantics to, the $PATH shell variable (or $path csh variable). EXIT STATUS
The following exit values are returned: The directory was successfully changed. An error occurred. EXAMPLES
To change to your home directory, enter: cd To change to a new directory, enter: cd /usr/include This changes the current working directory to /usr/include. Now file pathnames that do not begin with / or ../ specify files located in /usr/include. To go down one level of the directory tree, enter: cd sys If the current working directory is /usr/include and if it contains a subdirectory named sys, then /usr/include/sys becomes the cur- rent working directory. To go up one level of the directory tree, enter: cd .. The special filename .. (dot dot) always refers to the directory immediately above the current working directory. ENVIRONMENT VARIABLES
The following environment variables affect the execution of cd: A colon-separated list of pathnames that refer to directories. If the directory operand does not begin with a / (slash) character, and the first component is not (dot) or cd command will search for directory relative to each directory named in the CDPATH variable, in the order listed. The new working directory will be set to the first matching directory found. An empty string in place of a directory pathname represents the current directory. If CDPATH is not set, it will be treated as if it were an empty string. The name of the home directory, used when no directory operand is specified. Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization variables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte char- acters in arguments). Determines the locale for the format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. A pathname of the previous working directory, used by the cd - form of the command. The cd command sets this variable to your current working directory before changing to a new current directory. A pathname of the current working directory, set by the cd command after it has changed to that directory. SEE ALSO
Commands: csh(1), ksh(1), pwd(1), Bourne shell sh(1b), POSIX shell sh(1p) Functions: chdir(2) Environment: environ(5) Standards: standards(5) cd(1)
All times are GMT -4. The time now is 05:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy