![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multiple functions | amitrajvarma | Shell Programming and Scripting | 1 | 11-27-2007 11:21 AM |
| Use of functions | amitrajvarma | Shell Programming and Scripting | 1 | 11-23-2007 06:52 AM |
| ksh functions | scriptingmani | Shell Programming and Scripting | 3 | 07-06-2007 07:15 AM |
| functions in | Raom | Shell Programming and Scripting | 6 | 07-21-2006 03:06 AM |
| FTP functions | hzambra | High Level Programming | 3 | 05-03-2002 01:06 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Regarding functions
Hi,
I have a function or script like this. show() { echo "Hi" } | tee -a log show This creates a logfile and prints Hi in it. Now when I try to do the same for sql like this: show() { sqlplus -s scott/tiger<<! select * from details; ! } | tee -a log show Then it gives me a error telling me that :show not found. What am I doing worng here. Please put some light on this. Thanks in advance |
|
|||||
|
Quote:
show() { echo "Hi" ; } will define a function but does not run it. No output occurs. show() { echo "Hi" ; } | tee -a log The pipeline forces creation of a subshell. The subshell defines a function then exits producing no output. The empty output is piped to tee. With the -a option, tee appends nothing to the file. Maybe the file had Hi from a previous run?. The pipeline exits. Now when the parent shell next encounters "show", it will have no idea what that is supposed to be. show() { echo "Hi" ; } show | tee -a log is maybe what you are trying to do. Or show () { echo "Hi" | tee -a log ; } show |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|