Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to echo text and parameter to user on one line

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
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 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.:

636 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