I need help in BASH

Hi to all i need help in some bash scripting, who can help ?

Perhaps it’s quote off-topic but I could help…

just shoot

i need Bash script that :
a) GO to the Remote Server IP by ssh
b) run on remote server 'some command’
c) check 'uptime’
d) save step B and step C to remote file
e) compress file from step D and push it to the computer from which I run this script

If I remember correctly the -c flag in ssh runs commands in a remote shell.

You can pipe the output on your local PC.

ok… this is your solution, now explain your problem :smiley:

Ok i need use scp and ssh -c?!
Next i need bash script to show what service compare with port from /etc/services

can’t understand you, could you explain what are you aiming to?

So i need bash script , when you enter ./service.sh 80 they should give name of service that come in file /etc/services

echo "Enter the port you want to check"
read port
echo “Enter kind of port tcp/udp"
read proto
grep " “$port”/”$proto /etc/services | awk -F# '{ print $2 }'
if [ $? -eq 1 ]
then
echo "No results found"
fi

The problem was that he wanted to grep what was the service
name/description from /etc/services given a port

You can create a script with the command you want to run and ‘C’ on the remote server. Run it using SSH and then use SCP to collect the logs from said script.
What commands in addition to uptime are you looking to do?