command << EOF(dont want to call other script)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting command << EOF(dont want to call other script)
# 1  
Old 11-15-2007
command << EOF(dont want to call other script)

Dear Freinds,

Help needed in input redirection .
My problem is as follows..
I have a shell script as follows which calls another gnuplot script .

datagen.sh
Code:
#!/bin/ksh

gnuplot plot_I.plt

In the above file I am calling another file called plot_I.plt which reside in the same directory
Now my problem is I dont want to call that file instead of I want to merge that file plot_I.plt to datagen.sh and delete that file plot_I.plt

plot_I.plt
Code:
#!/usr/local/bin/gnuplot -persist

reset
set xrange[0:10400]
set x2range[0:2600]
plot "I_indat.txt" ax x2y1 with lines, "I_outplot" with lines
pause -1

Code:

I know there is command in unix to input a file like
command << EOF
EOF . But never used it . Please help how to input redirection using the above command or anything beside this..

I tried something like this but wont get sucess..
Code:
 gnuplot <<EOF
#!/usr/local/bin/gnuplot -persist
reset
set xrange[0:10400]
set x2range[0:2600]
plot "I_indat.txt" ax x2y1 with lines, "I_outplot" with lines
pause -1
EOF`

I am sure I am wrong with my code , please help ..
Thanks in advance..
user_prady

Last edited by user_prady; 11-16-2007 at 01:55 AM..
# 2  
Old 11-15-2007
Next time post your code in [ CODE ] [ /CODE ] blocks.

But using my intuition I can guess that your EOF has spaces to the left of it. It should immediately follow the line feed.

Not like this

Code:
      cat ... <<EOF
        blah
        EOF

but like this

Code:
      cat ... <<EOF
blah
EOF

# 3  
Old 11-15-2007
Quote:
Originally Posted by porter
Next time post your code in [ CODE ] [ /CODE ] blocks.

But using my intuition I can guess that your EOF has spaces to the left of it. It should immediately follow the line feed.

Not like this

Code:
      cat ... <<EOF
        blah
        EOF

but like this

Code:
      cat ... <<EOF
blah
EOF


Sorry for that..As much as possible I am trying my best to explain.

Now I am doing like below
First method:
Code:
  echo "#!/usr/local/bin/gnuplot " > plot_I.plt
  echo "reset" >> plot_I.plt
  echo "pause -1" >> plot_I.plt

  gnuplot plot_I.plt  #calling the file plot_I.plt

Its working fine.

Please help me do the same with <<EOF



Yes I did that..
Code:
gnuplot <<EOF
#!/usr/local/bin/gnuplot -persist 
reset 
pause -1 
EOF

But One problem when I do the same with a temporary file, I mean with the 1st method the plot remains there until I press quit. But in this case ie, <<EOF case it comes for a fraction of second then vanish automatically..


Thank you..
user_prady
--

Last edited by user_prady; 11-15-2007 at 04:20 AM..
# 4  
Old 11-15-2007
Quote:
Originally Posted by user_prady
Sorry for that..And I am sure I have no spaces left to EOF marker.
Yes you do, look for your code like

Code:
   pause -1
  EOF`

That looks like two spaces to me.
# 5  
Old 11-15-2007
Quote:
Originally Posted by porter
Yes you do, look for your code like

Code:
   pause -1
  EOF`

That looks like two spaces to me.
Yeah You may be right Mr. Porter.. But My guess was
<<....EOF to the left of EOF . Thats why I said I have no spaces left to EOF.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to use scl enable python command call with in bash shell script?

I have a bash shell script, within it i am using the below two commands . its failing right on scl enable command itself. if i run it by itself without a shell, it works fine. by default it is using pythin version 2.6 something. i want to use 3.4 version for that reason with in the shell... (3 Replies)
Discussion started by: cplusplus1
3 Replies

2. UNIX for Dummies Questions & Answers

Call a UNIX script inside another and dont wait for it

Hi I have two scripts script1.sh and script2.sh(say this script is a long running). I want to call script2.sh inside and script1.sh,but when i call script2.sh i dont want to wait for script2 to complete and want this to run in back ground and go on next commands in script 1.sh and finally at the... (2 Replies)
Discussion started by: lijjumathew
2 Replies

3. AIX

Commands to call script work from command line but not from Cron entry

My first post evidently did not materialize so I posted it again: Runnning a cron job every 5 mins to send data files to a state facility. My original cron entry at worked fine: 01,06,11,16,21,26,31,36,41,46,51,56 * * * * /home/sftpuser/stateinoc-from-appname.ksh Somewhere I have a... (1 Reply)
Discussion started by: Skyybugg
1 Replies

4. UNIX for Advanced & Expert Users

Trapping a kill command sent to a script and using it to send an EOF to a subprocess before killing

I originally had a script written in pure shell that I used to parse logs in real time and create a pipe delimited file that only contained errors. It worked but it was using a lot of memory (still not clear on why). I originally got around this by writing a wrapper for the script that ran on cron... (1 Reply)
Discussion started by: DeCoTwc
1 Replies

5. Shell Programming and Scripting

How to call a bash command from within a perl script?

In a bash script, one can call a perl command in the following manner, where "myperlcommand" is a perl command. perl -e 'myperlcommand(arguments)' perl -e 'print("UUUU"x4)' Now, how can one call a bash command from within a perl script? (Suppose that mybashcommand is a bash... (1 Reply)
Discussion started by: LessNux
1 Replies

6. Shell Programming and Scripting

How to call the System command twice in the same perl script...

Hello experts, I have a perl script which looks for the ARGV and then loads the data as per it. Example. #Checking the server to connect if ($ARGV eq 'QA') { $ENV{"ORACLE_HOME"} = "/oracle/product/11.2.0"; $ENV{"PATH"} = "$ENV{'PATH'}:/oracle/product/11.2.0/bin"; ... (1 Reply)
Discussion started by: msrahman
1 Replies

7. Shell Programming and Scripting

Script call : head: command not found

Hi, i am launching a script which open a ssh connexion to a cluster's node. Once on the node, the script calls the problematic command head and wc. I receive a message error as follow which come from two different scripts : line 31: head: command not found line 18: wc: command not found ... (6 Replies)
Discussion started by: masy1800
6 Replies

8. UNIX for Dummies Questions & Answers

mv command if you dont know the full name of the file

Hi all. I have a problem renaming a file. It is called "data_200711051002.csv" (for example) and I want to rename it automatically to "data.csv" in a routine in a program named Ascential. Those numbers are a time stamp, so every time the file is loaded into the server, they will change. ... (2 Replies)
Discussion started by: absolutdani
2 Replies

9. Shell Programming and Scripting

Run remote EOF command

I have the command cat - << _EOF | ed /home/fred/test >/dev/null 2>&1 2 s#u_pwd=*:#u_pwd=${Password}:# 3,$ s/u_succhg#*:/u_succhg#${Date}:/ w q _EOF I works great on the local system but I need to ssh to a remote system and run this command without... (1 Reply)
Discussion started by: insania
1 Replies

10. UNIX for Dummies Questions & Answers

how can call perl script as command?

Hello say i have written some perl scripts , now i like to call them in my unix shell as unix command like "more" , "ls" , "grep" so that my say perl script called "foo.pl" will be called from every where as "foo" or "foo arg1 arg2"? Thanks (1 Reply)
Discussion started by: umen
1 Replies
Login or Register to Ask a Question