Redirecting input in a unix shell script?
I have several SCO Unix script that read a parameter from user input or otherwise I put the param within my script, such as ftp scripts and so on. How can I read those parameters from a file insted?
Example: I write an ftp script that will connect to a remote location and bring files, right now I write the same script as many times as I have a remote location, but I'd rather substitute the open xxxx from a file. Also if it is an interactive script and the user need to send to more than one location then I need to be able to collect all the location numbers then read then into my script.
Look at the "-n" flag to the FTP program if that's what you're working with. On my system, here's what it says:
Why is this useful? Because you can then...
Example: I write an ftp script that will connect to a remote location and bring files, right now I write the same script as many times as I have a remote location, but I'd rather substitute the open xxxx from a file. Also if it is an interactive script and the user need to send to more than one location then I need to be able to collect all the location numbers then read then into my script.
Look at the "-n" flag to the FTP program if that's what you're working with. On my system, here's what it says:
-n | Restrains ftp from attempting ``auto-login'' upon initial connection. If auto-login is enabled, ftp will check the .netrc (see below) file in the user's home directory for an entry describing an account on the remote machine. If no entry exists, ftp will prompt for the remote machine login name (default is the user identity on the local machine), and, if necessary, prompt for a password and an account with which to login. |
Why is this useful? Because you can then...