Solved

How to echo text and parameter to user on one line

Posted on 2007-04-05
4
244 Views
Last Modified: 2010-04-21
I'm an Oracle PL/SQL Developer/Consultant.  As a consultant I've also been tasked with writing UNIX scripts, even though the client can't give me access to the UNIX box because their security folks won't allow it.  Therefore, I can't "play around" like I'd want to...to figure this out.

I'm trying to echo back to the user, who wil be at the UNIX prompt, when they run the script a text message along with a parameter.

In PL/SQL I'd write it like this:

prompt 'The following parameter, '||p_Name||' has not been defined.'
OR
dbms_output.put_line('The following parameter, '||p_Name||' has not been defined.');

In UNIX (korn shell script) I've written it this way - and I realize that the pipes cannot be used for concatenation, which is why I'm asking this question:

echo "The following parameter, $NAME has not been defined"

Is the above correct or will it literally use $NAME instead of value of $NAME?  If it's not correct please let me know how I should procede to get the desired result OR please let me know if I'm on the right track.

Thanks!
0
Comment
Question by:roschera
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 58

Accepted Solution

by:
amit_g earned 125 total points
ID: 18860024
You are on the right track. $NAME is between double quotes so its value will be echoed. If you wanted it literally you would use single quote.

BTW, without access to the UNIX box, how your client expects you to write a script and assume that it would work when run? You should at least be given a limited access - may be just dev box with very restricted access. Anyway, you can may be download cygwin (www.cygwin.com) and install and have your own command shell - it may not be exactly same as the target UNIX but it would still help.
0
 

Author Comment

by:roschera
ID: 18860300
Thank you so much!  The client does realize that anything I send up has not been tested in any way, shape or form.  Right now, I guess they just want something they'll probably have to fix, instead of writing it themselves from scratch.

Thanks for the tip on www.cygwin.com.  Does it use korn shell?  Or can it be made to act like it's running korn shell?
0
 
LVL 58

Expert Comment

by:amit_g
ID: 18860310
It is full UNIX emulation for windows. It has all the shells but only a few like bash, ksh are installed by default. You may have to choose custom install.
0
 

Author Comment

by:roschera
ID: 18860330
Thanks!  I'll check it out - it would be nice to actually be able to run a script.  =)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question