new scripter


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
# 1  
Computer new scripter

Hello all,

new to scripting (and unix!) here. Im trying to write a script for something i have to do for work and for some reason it just isnt working.

im using the ksh.

Can someone please tell me why

Code:
$PRODUCT=$1

CONFIG=./etc/$PRODUCT_config.xml

print Using $CONFIG

prints "Using ./etc.xml" ?
# 2  
Try this:
Code:
$PRODUCT=$1

CONFIG=./etc/${PRODUCT}_config.xml

print Using $CONFIG

The shell is interpreting PRODUCT_config as the variable name rather than PRODUCT, because _ is allowed to be part of variable name.
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #141
Difficulty: Easy
The original Unix operating system was not written in assembly language.
True or False?

1 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Begining Shell scripter

I am trying to write for my class project a shell script, using bourne shell, that will take one command, either -l or -w. If -l is entered then the script should output the names of all the files in my working directory sorted in increasing order of the number of lines in the file. If -w is input... (2 Replies)
Discussion started by: C.Ronaldo-7-
2 Replies

Featured Tech Videos