UNIX script / Command >>> in one line | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

UNIX script / Command >>> in one line

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 11-16-2011
rbadveli rbadveli is offline
Registered User
 
Join Date: Nov 2011
Last Activity: 16 November 2011, 4:33 PM EST
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
UNIX script / Command >>> in one line

Hi Experts,

Basically I am a SAP programmer. I don't know much about UNIX. But I got a situation, need to use UNIX script /command in my programming.

I searched the forum and found the below code.

I would like to pass the below UNIX script in my programming code. But my programming will not allow line by line.
Can I able to pass below script in one single line.

Please share your answers.

============

Code:
outputFile="/tmp/out.html" 
( 
echo "From: abc@xyz" 
echo "To: def@xyz" 
echo "MIME-Version: 1.0" 
echo "Subject: Test" 
echo "Content-Type: text/html" 
cat $outputFile 
) | sendmail -t

============

Thanks in Advance
Raghu

Last edited by pludi; 11-16-2011 at 05:46 PM..
Sponsored Links
    #2  
Old 11-16-2011
Corona688 Corona688 is online now Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 24 April 2014, 7:36 PM EDT
Location: Saskatchewan
Posts: 18,539
Thanks: 682
Thanked 3,036 Times in 2,856 Posts
Yet again and forevermore I deeply sympathize with anyone forced to use that.

This code will only work in an actual shell. If SAP doesn't run it in an actual shell, it'll give you errors like `outputFile="/tmp/out.html"': command not found


Code:
outputFile="/tmp/out.html" ; ( echo "From: abc@xyz" ; echo "To: def@xyz" ; echo "MIME-Version: 1.0" ; echo "Subject: Test" ; echo "Content-Type: text/html" ; cat $outputFile ) | sendmail -t

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
perl/unix: script in command line works but not in perl kpddong Shell Programming and Scripting 2 01-11-2011 01:27 PM
unix command : how to insert text at the cursor location via command line? xib.be UNIX for Advanced & Expert Users 0 12-22-2010 05:45 PM
Need help! command working ok when executed in command line, but fails when run inside a script! 4dirk1 Shell Programming and Scripting 4 12-02-2010 05:47 AM
assign a command line argument and a unix command to awk variables sweta_doshi Shell Programming and Scripting 0 08-08-2008 06:54 AM
Unix Script with line number at beginning of each line. mascorro Shell Programming and Scripting 5 06-19-2006 04:34 PM



All times are GMT -4. The time now is 07:41 PM.