script providing input to application prompts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script providing input to application prompts
# 1  
Old 02-08-2005
script providing input to application prompts

Hi!

I want to write a script that will create an archive (via tar) that will restrict the size of the tar file. The size can be constrained using the keyword 'k' and providing the size restriction. The problem is that the script needs to know (detect) when the tar command prompts the user (which will be this script) so that the script can copy the tar file to a temporary file (like tarFileName.1) and then return control back to the tar command to create the next volume.

(hope you could follow that logic)

My problem is I know of no mechanism in scripting in unix that allows for this kind of command flow control. Does it exist? Can anyone suggest a method I can use for this? (interrupt handlers; subs; ....)

tia,
mitch

ps the reason for needing to limit the size is to allow a customer to ftp some huge subdirectories (>10Gb) in bitesize pieces. The script will first gzip all the files, then archive them into volumes of, say, 100Mb in size. But the tar command prompts the user to change the archive media and hit RETURN to continue. The operator needs to copy the tar file to some other file, then hit return for this method to work.
# 2  
Old 02-09-2005
You can do it in much simpler way in three steps:

1. Create the full archive file xxx.tar.gz or xxx.tar.

2. split -b <size> xxx.tar.gz
where <size> is the size of single piece.

3. mv xaa xxx_1.tar.gz
mv xab xxx_2.tar.gz
.................................


In order to reassable the pieces togather again

cat xxx_1.tar.gz xxx_2.tar.gz ..... xxx_N.tar.gz > myarchive.tar.gz
# 3  
Old 02-09-2005
thanks

ya gotta like simple - thanks

mitch
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Using tee command with ablity to provide input for prompts

OS version: RHEL 7.4 Shell : bash I would like to capture command outputs using tee like # yum upgrade | tee yumupgradeLog But, if I use tee command, I cannot respond to prompts like Is this ok : during command execution as shown below. Is there a way I could use tee and still be able to... (4 Replies)
Discussion started by: kraljic
4 Replies

2. Shell Programming and Scripting

Sqlldr call via shell script prompts error

Good morning, I'm attempting to call sqlldr via shell script and it is prompting endIf is unec #!/bin/sh cd /tmp/v_tst FILENAME_WANTED=`date +"HourlyData_%Y%m%d_%H00.txt"` echo "FILENAME_WANTED = ${FILENAME_WANTED}" LIST_OF_FILES=`ls -rt HourlyData*.txt |tail -1` LIST_OF_FILES=`basename... (4 Replies)
Discussion started by: V1l1h1
4 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

Bash script to start program and answer prompts?

I'm trying to write a script the simplifies the execution of a program: After starting the program (sh ~/.mfix/model/make_mfix) I am prompted four times for options: Do you need SMP version? (y/n) Do you need DMP version? (y/n) Do you need debug version? (y/n) Force re-compilation of... (2 Replies)
Discussion started by: lanew
2 Replies

5. Shell Programming and Scripting

perl Rover script - anticipating prompts

At work I use this rover script to perform ID administration of machines that have no central management system. The one problem I encounter is the prompt of the machine I'm trying to reach. For instance, by default rover looks for $, which most *nix prompts do end with a $, and tries to... (0 Replies)
Discussion started by: MaindotC
0 Replies

6. Shell Programming and Scripting

Help needed with bash script providing battery status

I'm really new to even doing a bash "hello world" script, so maybe someone would know how to do the following task, using bash scripting Need to login using ssh from one dell server into another dell server, and obtain the raid battery status, using dell's open manage software commands; then... (5 Replies)
Discussion started by: AJ-102111
5 Replies

7. Shell Programming and Scripting

script prompts the user to enter four lines.

The script prompts the user to enter four lines. (1 Reply)
Discussion started by: polineni
1 Replies

8. Shell Programming and Scripting

Passing text to RCS prompts in KORN script,

Hopefully someone can help here. I have a script written in korn by a former employee and I am trying modify it. Most of the script works except when we run it and pass the tesxt 'unlock' as a parameter when we want to unlock a file in RCS (revision control system). When we run this script and use... (2 Replies)
Discussion started by: pjones0066
2 Replies

9. Shell Programming and Scripting

Shell script answer prompts?

Hi, I'm writing a script that calls a function to generate a certificate. In generating this certificate, I'm asked a series of questions. I was wondering, is there a way to pre-program my script to answer these questions in the same way all the time. I saw something like EOF>> y EOF ... (4 Replies)
Discussion started by: eltinator
4 Replies

10. Solaris

pkgadd pkgask still prompts for user input

I create a succesful pkgask 'response' file: pkgask -r xyz.pkg I then attempt to use the 'response' file with pkgadd: pkgadd -nr /home/user/response -d /home/user/xyz.pkg the prompts for user input still appear. I have also tried an 'admin' file but that still prompts for user input as... (1 Reply)
Discussion started by: prkfriryce
1 Replies
Login or Register to Ask a Question