i am trying to find a way to put an interactive script in the background after taking input from the user
a few test lines i was trying:
date
echo "Enter location"
LOCATION=
read LOCATION
sleep 100
sleep 200
date
for this small example i want the script to as the user for the location. once the location is supplied then it should execute the subsequent commands in the script in the background and return control of the tesrminal to the user.
Take input.. for example a location code
wait (or, submit to background)
After you input, couldn't you just call another script/program (and put that in the background if need be)?
After input of data, to pass data to other program you could:
1) export the variable
2) pass the variable as a parameter
3) write the variable to a file, and read in called program
Perhaps a little more detail on what you are trying to do.
System Shock -- & doesnt work as when i supply the location it gives an error "Execute permission denied", in other words it doesnt read it as the input to the script but a separate command itself
joeyg -- your idea makes sense. but i was looking for something like a single script way of achieving this.
sb008 -- your idea needs manual intervention. i am giving this to a few non-tech folks who will input what they have to. i cant expect them to find the pid and put it in bg, hence the question.
If you create a script that takes input and then executes a command and puts it in the background, it works.
Say you touch a file in /tmp named hello, then you take a file name, pass it to a find command, and put that find command in the background...
After you run the script, you hit the enter key, and you get your prompt back while the find command runs in the background. As for the error you are getting, permission denied means you don't have enough permissions to do something, but I can't tell what it is from what you posted.
Another way of doing it, would be to take the input on the command line, rather than a read command, then you can just put the whole thing in the background, like: