dynamic input to a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting dynamic input to a script
# 1  
Old 09-22-2010
dynamic input to a script

Hi All,
I am stuck in a situation where there is a script, say test1.tcsh which is being called from another script ,say test2.tcsh

test1.tcsh:-
Code:
#!/usr/local/bin/tcsh
echo -n "Do you wanna test [y/n]??"
set answ = $<
echo $answ
if ($answ =~ "y") then
        echo -n "enter your name <"
        set name1 = $<
        #echo $name1
        echo -n "enter your script name <"
        set scr_name = $<
        #echo $0
        if ("$scr_name" =~ $0) then
                echo "correct"
        else echo "Wrong script name :O \!\!!"
endif
else echo "You chose to end testing"
endif

If I happen to run this script, it works like:-
Code:
Do you wanna test [y/n]??y
y
enter your name <kk
enter your script name <test1.tcsh
correct


Now the problem is: Say, test1.tcsh runs under a loop in test2.tcsh
i) Its a big loop, with lots of functionality taking 6-10 hrs
ii) I can't edit test1.tcsh, all I know is it asks three questions

How can I give inputs without sitting for 6-10 hrs waiting for script to ask for last input?

I can do it had there been just a question:
Code:
echo "y"|./test1.tcsh

Do you wanna test [y/n]??y
y
Do you wanna test [y/n]??y
y

but how to give answers for rest two questions???

Please Suggest..


Moderator's Comments:
Mod Comment Please use code tags, thank you

Last edited by Franklin52; 09-22-2010 at 04:08 AM..
# 2  
Old 09-23-2010
What are code tags??
sorry but I am new to it..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Building a dynamic UNIX menu with input files

Hi! I am looking to build dynamic menu (named: lookup.sh) that reads a pipe delimited file for input. for example, contents of input.txt could be: user1|srv1 user3|srv1 user4|srv1 user2|srv2 I want the menu look like: 1) get password for user1 on srv1 2) get password for user3 on... (7 Replies)
Discussion started by: cpolikowsky
7 Replies

2. Shell Programming and Scripting

Dynamic script and cron

Hello friends, I have a script.sh running, i need to move his generated file to another path and restart it every 24h. is there a way to restart it from a script in a dynamic way without create a duplicate process? script.sh & mv file to /path script.sh & many thanks for your help (7 Replies)
Discussion started by: kraterions
7 Replies

3. Shell Programming and Scripting

Script to delete files with an input for directories and an input for path/file

Hello, I'm trying to figure out how best to approach this script, and I have very little experience, so I could use all the help I can get. :wall: I regularly need to delete files from many directories. A file with the same name may exist any number of times in different subdirectories.... (3 Replies)
Discussion started by: *ShadowCat*
3 Replies

4. Shell Programming and Scripting

Help Create dynamic ksh script from a script

I am currently running 2 scripts to gather data for a 3rd script and would like to combine the 2 scripts into one. Having issues with the final output format. Note cannot post URL so replaced the http stuff with (name) in the examples All scripts contain #!/bin/ksh OS = Red Hat Enterprise... (0 Replies)
Discussion started by: pcpinkerton
0 Replies

5. Shell Programming and Scripting

Creating Dynamic Input or daa files

Hi, I got a requirement to automate the process. We have SLA files, there are some 80 SLA files comes from 1.30pm - 5.30pm. I was asked to write a script to check for the SLA files in the load directory, if the files come then we got to send the mail to the group, if the mails doesnt come... (1 Reply)
Discussion started by: afahmed
1 Replies

6. Shell Programming and Scripting

Help with dynamic script

Hey there, first post, somewhat-long-time lurker- This is on a Red Hat box Im working on a new site, and I have an idea for a dynamic CGI script to change who is "on call" Pretty much, it would pull next name from a text file each week to display it on the site, and just keeps cycling through... (3 Replies)
Discussion started by: rapenchukd
3 Replies

7. Shell Programming and Scripting

Dynamic output file generation using a input text file with predefined output format

Hi, I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format. Example: File.txt AP|{SSHA}VEEg42CNCghUnGhCVg== APVG3|{SSHA}XK|"password" AP3|{SSHA}XK|"This is test" .... etc --------- test.sh has... (1 Reply)
Discussion started by: hudson03051nh
1 Replies

8. Shell Programming and Scripting

Assigning values for a dynamic array for an input

Hello, Can somebody please give me a snippet for the below requirement. I want to assign the values separeted by a comma to be assigned to a dynamic array. If I give an input (read statement) like abc1,abc2,abc3,abc4,abc5, all these strings abc* should be assigned to an array like below... (2 Replies)
Discussion started by: suneelj
2 Replies

9. UNIX for Advanced & Expert Users

Sql dynamic table / dynamic inserts

I have a file that reads File (X.txt) Contents of record 1: rdrDESTINATION_ADDRESS (String) "91 971502573813" rdrDESTINATION_IMSI (String) "000000000000000" rdrORIGINATING_ADDRESS (String) "d0 movies" rdrORIGINATING_IMSI (String) "000000000000000" rdrTRAFFIC_EVENT_TIME... (0 Replies)
Discussion started by: magedfawzy
0 Replies

10. Shell Programming and Scripting

dynamic global script

Hi, I have to create a global dynamic script which should ask for the env or some other variables and then create the soft links. let's say that I have to create ten soft links and the path for these soft links is different for each env for e.g: WDEV: /d02/app/applmgr/wdev/appl/CDCRM/bin... (2 Replies)
Discussion started by: isingh786
2 Replies
Login or Register to Ask a Question