keep I/O Redirection programming interactive


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting keep I/O Redirection programming interactive
# 1  
Old 07-12-2009
keep I/O Redirection programming interactive

when using I/O redirection to program another program from a script, how can you keep the program open in an interactive state without closing. For example:

gdb <<EOF
file a.out
run
EOF

this will open up gdb and run the commands and then close... how can I make it so I can open up a program (not limited to gdb) and keep it open after running a few starting commands?

I tried putting something other than EOF, but no matter what it seems to quit the program after the script has run.
# 2  
Old 07-12-2009
Try sourcing your script instead of just executing it i.e.
Code:
. path_to_your_script

# 3  
Old 07-12-2009
nope, that won't work either, but, I do have a question about your reply, what does "sourcing it instead of executing it" do?

as far as progress towards the original question, I tried simply removing the terminator, with no luck...

Code:
gnuplot <<ENDCAT
plot sin(x)

# 4  
Old 07-12-2009
Reading the man page would have give you this for gdb.

There is no simple generic way to do this.

Code:
cat > file <<EOF
file a.out
run
EOF

gdb -x file


for gnuplot:

Code:
cat > file2 <<EOF
plot sin(x)
EOF

gnuplot file2 -

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

From iOS programming to Linux system programming

Hello. I like Linux and C programming language. Allways wanted to understand kernel and become a Linux system programmer. And I also like Objective-C and iOS. These two programming areas have relations: 1. Linux and iOS are UNIX-like systems, POSIX compliant. 2. It is useful to know C language... (2 Replies)
Discussion started by: Rockatansky
2 Replies

2. UNIX for Dummies Questions & Answers

How does unix system administration, unix programming, unix network programming differ?

How does unix system administration, unix programming, unix network programming differ? Please help. (0 Replies)
Discussion started by: thulasidharan2k
0 Replies

3. Shell Programming and Scripting

Interactive script – if then

Hi, I am writing an interactive shell script (ksh) but I have no idea how I could make a condition on it : Variables : rep_config="${rep_tools}/_CONFIG" rep_config_old="${rep_config}/_PROTO_OLD" Here is the interactice part : lst_proto=$(cat... (2 Replies)
Discussion started by: Aswex
2 Replies

4. Shell Programming and Scripting

SSH non-interactive

Hi, I want to know how to use SSH non-interactively? I am already able to use sftp -b <batch file> user@host so public/private key set-up already is in place. But my supervisor has told me to use SSH now I want to know how it can be done? I want to do something like: done_files=`ssh ls... (7 Replies)
Discussion started by: dips_ag
7 Replies

5. Programming

C Programming - Hardware Programming

Can someone help me on suggesting some ways to access the memory content in RAM directly from C/C++ source code. Please provide me any book name or any URL so that I can get an exhaustive knowledge over it. If possible please give me some tips on interacting with hardwares directly through... (3 Replies)
Discussion started by: nandumishra
3 Replies

6. Homework & Coursework Questions

How to write script that behaves both in interactive and non interactive mode

Q. Write a script that behaves both in interactive and non interactive mode. When no arguments are supplied it picks up each C program from the directory and prints first 10 lines. It then prompts for deletion of the file. If user supplies arguments with the script , then it works on those files... (8 Replies)
Discussion started by: rits
8 Replies

7. Homework & Coursework Questions

Help with Interactive / Non Interactive Shell script

Q. Write a script that behaves both in interactive and non interactive mode. When no arguments are supplied it picks up each C program from the directory and prints first 10 lines. It then prompts for deletion of the file. If user supplies arguments with the script , then it works on those files... (1 Reply)
Discussion started by: rits
1 Replies

8. UNIX for Dummies Questions & Answers

Carreer:Networking Programming in Unix (C programming Language)

Hello, I am trying to learn Networking Programming in C in unix enviorment. I want to know how good it is to become a network programmer. i am crazy about Network programming but i also want to opt for the best carreer options. Anybody experienced Network Programmer, please tell me is my... (5 Replies)
Discussion started by: vibhory2j
5 Replies

9. Programming

c programming or unix programming!?

i would like advice on the usbject of c programming (in the middle of reading a book on C). could i benefit more if i apply that knowledge in the unix format if i were able to, or would that take the point out of learning C, basically I want to stay away from strying too far away from unix and use... (1 Reply)
Discussion started by: moxxx68
1 Replies

10. Shell Programming and Scripting

Interactive String

I intend to write a script, where the user will supply the name of the specific string that script should work on. The first question is how do I accept the string, i.e interactively? and the second question how would the string be refrenced ? Thanks in advance, Odogbolu98 :( (3 Replies)
Discussion started by: odogbolu98
3 Replies
Login or Register to Ask a Question