Good morning everyone,
I want to run a simple grep script on a remote server.
Instead of having the user type the script and then the hostname, I would like them to be prompted to type the hostname, and then use the input they typed for $1.
The example below is called grep-error.sh
Code:
#!/bin/sh
ssh root@$1 grep -i error vision.error
As it is now, in order to execute this they will have type:
Code:
./grep-error.sh hostname
Instead of doing that, I would like to set it up so after they type the script into the command prompt, it asks them for a hostname:
Code:
./grep-error.sh
Please enter a hostname:
Then I want the hostname to be passed along to $1.
Any help is appreciated. Thanks.