I have two shell scripts one.sh and two.sh
I want to execute two.sh from one.sh. Below is the code :
#!/bin/sh
sh /home/ubuntu/two.sh
The next step ( where I got stuck). There is one point in two.sh when the user have to press enter to continue . Next after entering, I need to give the desired directory. I want to stimulate both the steps from one.sh
Any suggestions ???
So it worked by using printf, if you know exactly how many y your script is expecting you can do it like this:
$ printf 'y\ny\ny\n' | ./script
Can find more here : https://askubuntu.com/questions/338857/automatically-enter-input-in-command-line
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.