inline redirect stdin


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users inline redirect stdin
# 1  
Old 09-09-2008
inline redirect stdin

Hi:


I have the next script on ksh


#!/usr/bin/ksh
cd $FUENTES
qdesign <<-!
\$/opt/cognos/ph843e/bin/qtp <<-!
\$/opt/cognos/ph843e/bin/quiz <<-!
!
!
!

This script is very simple, i want to nest three process quiz into qtp, and this into qdesign.
When I run it , i receive the next error.

./aa[7]: !: not found
./aa[8]: !: not found

Why ?¿?¿

can i nest inline commads with input redir.


Regards
# 2  
Old 09-09-2008
I don't think you can, especially not with the same delimiter for them all. Perl has support for combining here documents but you still can't nest them there, only serialize.

Code:
perl -e 'print <<HERE; print <<THERE; print <<EVERYWHERE;
I am the walrus
HERE
The walrus was Paul
THERE
Happiness is a warm gun
EVERYWHERE
print "done.\n"'

But this is Perl only as far as I know.

What do you mean by nesting these, and how do you expect to achieve three of the "quiz" processes? Do you mean a pipeline, by any chance?

Code:
quiz | qtp | qdesign

That's still only one of each (pipes the output as quiz as the input to qtp, then the output from that as input to qdesign.)

Last edited by era; 09-09-2008 at 03:04 PM.. Reason: Pipeline speculation
# 3  
Old 09-09-2008
I also am confused, like Era, about what you are trying to achieve.

For the record, you can nest heredocs in ksh93 as shown by the following trivial example:
Code:
#!/usr/bin/ksh93

TMP=file.$$

cat <<< $(echo "first time") > $TMP

cat <<EOF1 >> $TMP
current date: $(date)
===================
$(cat <<EOF2
second time
current date: $(sleep 1; date)
===================
$(cat <<EOF3
third time
current date: $(sleep 1; date)
EOF3
)
===================
EOF2
)
EOF1

cat $TMP

rm $TMP

Code:
$ ./trivial
first time
current date: Tue Sep  9 21:48:52 EDT 2008
===================
second time
current date: Tue Sep  9 21:48:53 EDT 2008
===================
third time
current date: Tue Sep  9 21:48:54 EDT 2008
===================
$

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Redirect string from bash stderr to user stdin

Hi there, I need to execute a command in the bash. The program prints some standard (output and) error and then wants the user to choose one of several options and type the according input. I am trying to solve this issue in a bash script but also running into some circular dependency. How can I... (7 Replies)
Discussion started by: fredestet
7 Replies

2. Shell Programming and Scripting

Redirect String to STDIN

Looking for the proper way to bring a string into the stdin. I have a string that I would like to grep and awk. Each have to be run separately, not piped together. So far, the only way I could figure out how is to echo the string and pipe it: echo 'This is my string' | grep my (3 Replies)
Discussion started by: Panman82
3 Replies

3. UNIX for Dummies Questions & Answers

Redirect stdin stdout to multiple files

Hi, i know how to a) redirect stdout and stderr to one file, b) and write to two files concurrently with same output using tee command Now, i want to do both the above together. I have a script and it should write both stdout and stderr in one file and also write the same content to... (8 Replies)
Discussion started by: ysrini
8 Replies

4. Shell Programming and Scripting

loop logic inside of an inline redirect?

i need to log the feedback from the ftp server as i'm performing some deletes. the only way i know of to do this is with the inline redirect << EOF ... but from there to the closing EOF, it's like i'm at the ftp command prompt, so I don't know how to have ksh script logic in there I have an... (3 Replies)
Discussion started by: tlavoie
3 Replies

5. Shell Programming and Scripting

Cannot redirect to STDIN in a shell script

I am unable to use STDIn redirection with < (commands) When I do the following, both approaches work and give the same results: 1. $ printf "aaa\nbbb\n" > file1 $ printf "111\n222\n" > file2 $ cat file1 file2 aaa bbb 111 2222. $ cat <(printf "aaa\nbbb\n") <(printf "111\n222\n") aaa... (8 Replies)
Discussion started by: metaltree
8 Replies

6. Shell Programming and Scripting

inline redirect stdin

Hi: I have the next script on ksh #!/usr/bin/ksh cd $FUENTES qdesign <<-! \$/opt/cognos/ph843e/bin/qtp <<-! \$/opt/cognos/ph843e/bin/quiz <<-! ! ! ! This script is very simple, i want to nest three process quiz into qtp, and this into qdesign. When I run it , i receive the... (5 Replies)
Discussion started by: ct2marer
5 Replies

7. Programming

Redirect stdin and out to sockets

For windows was pretty simple to redirect the std in a and out of a child process for "cmd.exe " command prompt terminal to a socket using connected pipes passed to a new process in the STARTUPINFO structure. BOOL b = ::CreatePipe((LPHANDLE)h_stdInRead,(LPHANDLE)hsdtInWriteTmp, &SecAttrib,... (1 Reply)
Discussion started by: gyula
1 Replies

8. Shell Programming and Scripting

Inline Parameters-Urgent

Can someone tell me how to enter inline parameters with script call? This is a little urgent so some help would be highly appreciated. Thanks a lot. Indira (2 Replies)
Discussion started by: indira
2 Replies

9. Shell Programming and Scripting

redirect STDIN

can you redirect STDIN with command arguments? I have tried this approach: # ./script -option <argument1> <argument2> 0<$2 # $2: ambiguous redirect Is this possible? (4 Replies)
Discussion started by: prkfriryce
4 Replies

10. UNIX for Dummies Questions & Answers

stdin not tty when try to pine or redirect

My supervisor keep getting "stdin not tty" or something like that when he pipe or redirect input into a program. Others don't seem to get this message. Is there some way I can help him to fix or turn this off? Thx in advance (1 Reply)
Discussion started by: Micz
1 Replies
Login or Register to Ask a Question