Solved

How to echo text and parameter to user on one line

Posted on 2007-04-05
4
239 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
  • 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now