?
Solved

How to echo text and parameter to user on one line

Posted on 2007-04-05
4
Medium Priority
?
248 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 500 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month14 days, 10 hours left to enroll

770 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