Passing screen value to a program


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Passing screen value to a program
# 1  
Old 02-03-2010
Passing screen value to a program

Hi all,

I have the following question. Apparently not very difficult, but I'm not any expert.
I have a program, let's say program.x, and a bash script that execute it, let's say program.sh. When the program executes it asks for a value to continue. What I want is just passing the value throw the script execution (e.g. using $1) , just

>program.sh value

and a line of the script gives the order of passing that value to the screen when the program ask for it. Which would be that line? Thanks in advance
# 2  
Old 02-03-2010
Code:
printf "%s\n" "$1" | program.x

# 3  
Old 02-08-2010
Great!, it works, thanks a lot

J
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Help on passing an input variable to the voronota program (after third pipe)

Dear UNIX forum members, I am using macbook pro 13 (2015 edition) with MAC OS Mojave and am trying to write the shell script where when it is run through terminal it asks for an input (in the code below an input variable is domains) and then that input becomes capital letter or letters which... (3 Replies)
Discussion started by: Aurimas
3 Replies

2. Shell Programming and Scripting

Passing literal tab character from zsh to other program

I have a Zsh script which invokes another program. One of the paramters to be passed, should be a literal tab, i.e what in common programming languages is often written as "\t". If it were bash, I think I could use the special form $"\t" but this doesn't seem to work (the called program... (5 Replies)
Discussion started by: rovf
5 Replies

3. Shell Programming and Scripting

Passing multiple C program output into a shell

Hi I have the following C code # cat test.c #include <stdio.h> main() { printf ("The output is : Power\n"); printf ("The output is : No Power\n"); } The output of this C code is # ./test The output is : Power The output is : No Power Now i need to pass this outputs into a shell... (4 Replies)
Discussion started by: Priya Amaresh
4 Replies

4. Shell Programming and Scripting

Selecting files from a list and passing them to a program using csh

I have a list of files, example as shown below n02-z30-dsr65-ndelt0.25-varp0.002-4x3drw-csq.msf n02-z30-dsr65-ndelt0.25-varp0.004-4x3drw-csq.msf n02-z30-dsr65-ndelt0.25-varp0.006-4x3drw-csq.msf n02-z30-dsr65-ndelt0.25-varp0.008-4x3drw-csq.msf... (8 Replies)
Discussion started by: kristinu
8 Replies

5. Programming

Passing argument to a program!!

Hi friends, I have a small query, hope u will help me with it. I want to write a small program which would take an integer as an argument, then I want to save that argument in a variable of type int. Could you please help me with it. Here is my program #include <stdio.h> int main(int... (4 Replies)
Discussion started by: gabam
4 Replies

6. Shell Programming and Scripting

Passing answers to external program from KSH

I have asked this before but I haven't had any luck so far getting this to work. I use RCS(revision control system). When it runs if I pass the value 'unlock' to $3 its reassigned to $unlock. When I run the command (rcs -u'version number' 'filename') ti will ask me 1-(Do you want to break the lock... (5 Replies)
Discussion started by: pjones006
5 Replies

7. Solaris

Jumpstart Solaris Installation Program screen

Hi! I'm trying to skip the installation welcome screen (actually the first three screens: The Solaris Installation Program screen, Identify This System screen and date and time settings - not timezone settings). Everything else runs automaticly from jumpstart except these three screens, just... (6 Replies)
Discussion started by: Luka
6 Replies

8. Shell Programming and Scripting

Help in passing array of inputs to C program using script?

Hi, I have a file input which has 1000 data inputs of array elements. I would like to pass this to a C program one line at a time as input automatically. Anyone know how I could use "sed" to perform this? Appreciate alot. Thanks. (1 Reply)
Discussion started by: ahjiefreak
1 Replies

9. Shell Programming and Scripting

Passing value to an external program problem...

This code is in my 'case' statement and it all else works fine. The problem I have is that the value in 'procno' is not passed on to the external program (fireit). It is passing all zeros instead of the actual process number. By the time I get to this case statement, I know the "Number" and... (1 Reply)
Discussion started by: giannicello
1 Replies

10. Shell Programming and Scripting

Passing shell variables to awk program..

Hello, Can we pass shell variables like $PATH etc. to a awk program part for example, awk ' { fieldValue=$PATH .... }' file (1 Reply)
Discussion started by: Vishnu
1 Replies
Login or Register to Ask a Question