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 06:46 PM..
Sponsored Links
    #2  
Old 11-16-2011
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 26 November 2014, 5:04 PM EST
Location: Saskatchewan
Posts: 19,943
Thanks: 848
Thanked 3,420 Times in 3,205 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 02: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 06: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 06:47 AM
assign a command line argument and a unix command to awk variables sweta_doshi Shell Programming and Scripting 0 08-08-2008 07:54 AM
Unix Script with line number at beginning of each line. mascorro Shell Programming and Scripting 5 06-19-2006 05:34 PM



All times are GMT -4. The time now is 08:09 PM.