Solved

How to echo text and parameter to user on one line

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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…
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.

932 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

12 Experts available now in Live!

Get 1:1 Help Now