I have written a Bash Script that captures video via the Linux application DVgrab. When run my script prompts the terminal user to enter all the necessary information for the capture, save location, file name, file type capture duration etc...
These are all in the form of
This works great for me, my problem is that I want the script to run in such a way that once it finishes a capture it returns to the beginning of the script and asks for variables again to start another capture.
My first attempt was simply to add
And now you will see that I don't really know what I am doing or how to talk about it... I am just learning this stuff (I can only imagine there is a more correct 'repeat forever'?)
My problem here is that once the script goes back to the 'do' line it already 'knows' all the variables and just starts the same dvgrab capture again...
Is there a way to 'reset' all my entered variables? or perhaps some other method of looping that is more appropriate?
Hmm, I think I wasn't clear in what I'm trying to achieve. My problem is not related to stopping the script, but in getting the script to repeat.
There are 4 questions that the script prompts the user to enter as variables, and what I want to script to do is essentially start over once it's finished. So that after one tape ends, the script is already waiting for the information (a new instance of each of the variables) for the next tape to be entered...
As it stands I achieve this by simply typing in the command to run the script again after each tape finishes, but I want to eliminate this extra step.
Franklin52: Your Loop suggestion works perfectly for what I want, thanks...
But I've discovered my problem is not in my looping instructions, but in a -read- error, namely one that looks like this:
./test5: line 14: read: read error: 0: Resource temporarily unavailable
(line 14 is the last line in the code below)
When I run this code:
My actual script is much larger (400 lines, I can post it if that might help), but I've narrowed my problem to this error. As far as I can tell executing DVgrab does something that makes -read- "temporarily unavailable" and every instance of -read- after DVgrab has this error
In my larger script this has the effect of continuously applying the same variable entries (previously entered via -read-) and therefore continuously records the same clip length over and over
Any ideas why this is happening or what a workaround might be would be greatly appreciated, in the above test script I thought maybe putting DVgrab in a function might help, but it seems to have had no effect...
I am pretty new to Unix. Trying to pick up some slack while a coworker is out on vacation.
Basically the script is working fine however when I go through the testing phase and have to make mods it is a pita.
Here is an example of what I have
#!/bin/ksh
if
then
echo... (8 Replies)
Hi,
I have a out from a command i need to grep a report. For that i need loop 3 variable for that. How i can loop need help.
Symmetrix ID : 123456
Masking View Name : Host16
Last updated at : 04:13:06 PM on Thu Mar 17,2011
Initiator Group Name : Host16
Host... (3 Replies)
i am having a file contants as below
my requirement is
for file in `awk -F "," '{print $8,$9}'` <temp.txt
echo "$file"
echo "$file">test.txt
a=`awk -F "," '{print $1}' `<test.txt
b=`awk -F "," '{print $2}' `<test.txt
but script reads , i want both the vales for further... (5 Replies)
Greetings. I'm completely new to shell scripting and quickly trying to catch on. Here's my scenario:
I have a text file, named ip.txt, containing IP addresses. I want to automatically perform a whois query on each address in the file, search the output for the country, and then put both the IP... (4 Replies)
Hi,
I need help on for loop need to add domain and IP
In domain list
1.com
2.com
3.com
In Ip list
1.1.0.1
1.2.0.1
1.3.0.1
1.com 1.1.0.1
2.com 1.2.0.1
3.com 1.3.0.1
I need to excute this command (4 Replies)
Can we assign two variables in a for loop?
I have an input file:
000301|20100502
835101|20100502
I want to read this file in a for loop and assign values to two different variables.
I did this now but did not work
for STORE,RUNDATE in `awk -F\| '{print $1,$2}' inputfile
... (4 Replies)
Hi, say I have a simple sh script like this:
for i in a b c d
do
for j in 1 2 3 4
do
echo "$i $j"
done
done
and the output is
a 1
a 2
a 3
a 4
b 1 (20 Replies)
I'm trying to understand if it's possible to create a set of variables that are numbered based on another variable (using eval) in a loop, and then call on it before the loop ends.
As an example I've written a script called question (The fist command is to show what is the contents of the... (2 Replies)
Sorry for such a dreadful title, but I'm not sure how to be more descriptive. I'm hoping some of the more gurutastic out there can take a look at a solution I came up with to a problem, and advice if there are better ways to have gone about it.
To make a long story short around 20K pieces of... (2 Replies)
Hi Guys,
I have a scripts that uses a while loop to read a file and set 2 variables.
How can I do this so the variables can be used outside the while loop ?
Below is an example....# ./junk2 -m -e user
EXE=user master=TRUE
DB_TAG=PRODUCT
In loop MST=MST=testsvr1:3110
In loop ARGS=... (2 Replies)