UNIX script / Command >>> in one line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UNIX script / Command >>> in one line
# 1  
Old 11-16-2011
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..
# 2  
Old 11-16-2011
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

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script UNIX to read text file line by line

i have a text file as belows, it includes 2 columns, 1st is the column name, 2nd is the file_name data_file.txt column_name file_name col1 file1 col2 file2 col3 file1 col4 file1 col5 file2 now, i would like to... (4 Replies)
Discussion started by: tester111
4 Replies

2. UNIX for Advanced & Expert Users

Converting xls file to xlsx on UNIX script / command line.

Hi All, Am needing advise on how to convert xls file to xlsx format on Solaris unix command line or scripting. I tried searching online but it looks like I need to either use Perl packages of Excel or Python packages or some other 3rd party tool. Problem is to install any of these will require... (2 Replies)
Discussion started by: arvindshukla81
2 Replies

3. Shell Programming and Scripting

Calling another Script from Command Line in UNIX

Hi all, I am having problem in understanding the following line of code .. /home/rmsbatch/autoscript/autorms.ksh dc_load_main.ksh -q belk_dc_load_tran_data.seq What's being done here ? what does "-q" means ? What does ".seq" file means in unix "belk_dc_load_tran_data.seq" Please... (3 Replies)
Discussion started by: LoneRanger
3 Replies

4. Shell Programming and Scripting

How to read a two files, line by line in UNIX script and how to assign shell variable to awk ..?

Input are file and file1 file contains store.bal product.bal category.bal admin.bal file1 contains flip.store.bal ::FFFF:BADC:CD28,::FFFF:558E:11C5,6,8,2,1,::FFFF:81C8:CA8B,::FFFF:BADC:CD28,1,0,0,0,::FFFF:81C8:11C5,2,1,0,0,::FFFF:81DC:3111,1,0,1,0 store.bal.... (2 Replies)
Discussion started by: veeruasu
2 Replies

5. Shell Programming and Scripting

How to read a file, line by line in UNIX script?

#!/bin/bash file1="yxd" for file in `cat file3.txt`; do cat $file1 | awk '{split($1,dp,"."); lend=length(dp); if(lend>2) { dom=dp"."dp; split($2,ipl,","); for(i=1; i<=length(ipl); i++) { if(ipl~/:/) { if(ipl~/:/) i++; rip=ipl; i++; raq=ipl; rtq=0; si=i+4; for(;i<si;i++) rtq+=ipl; rsub="";... (2 Replies)
Discussion started by: veeruasu
2 Replies

6. Shell Programming and Scripting

Specify an entire UNIX command as a command line argument

I'm trying to write a bash script called YN that looks like the following YN "Specify a question" "doThis" "doThat" where "doThis" will be executed if the answer is "y", otherwise "doThat". For example YN "Do you want to list the file dog?" "ls -al dog" "" Here's my attempt... (3 Replies)
Discussion started by: LeoKSimon
3 Replies

7. Shell Programming and Scripting

perl/unix: script in command line works but not in perl

so in unix this command works works and shows me a list of directories find . -name \*.xls -exec dirname {} \; | sort -u | > list.txt but when i try running a perl script to run this command my $query = 'find . -name \*.xls -exec dirname {} \; | sort -u | > list.txt';... (2 Replies)
Discussion started by: kpddong
2 Replies

8. UNIX for Advanced & Expert Users

unix command : how to insert text at the cursor location via command line?

Hi, Well my title isn't very clear I think. So to understand my goal: I have a script "test1" #!/bin/bash xvkbd -text blabla with xbindkeys, I bind F5 key in order it runs my test1 script So when I press F5, test1 runs. I'm under Emacs/Vi and I press F5 in order to have "blabla" be... (0 Replies)
Discussion started by: xib.be
0 Replies

9. Shell Programming and Scripting

assign a command line argument and a unix command to awk variables

Hi , I have a piece of code ...wherein I need to assign the following ... 1) A command line argument to a variable e.g origCount=ARGV 2) A unix command to a variable e.g result=`wc -l testFile.txt` in my awk shell script When I do this : print "origCount" origCount --> I get the... (0 Replies)
Discussion started by: sweta_doshi
0 Replies

10. Shell Programming and Scripting

Unix Script with line number at beginning of each line.

Could anybody help me. I need to create a script that reads a text file from STDIN and prints out the file to STDOUT with line numbers at the beginning of each line. Thanks. (5 Replies)
Discussion started by: mascorro
5 Replies
Login or Register to Ask a Question