is running this command via ssh possible? (formatting issues)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting is running this command via ssh possible? (formatting issues)
# 1  
Old 08-19-2005
is running this command via ssh possible? (formatting issues)

Here is the command I want to run:

for pkg in `pkginfo | grep -i VRTS | awk '{print $2}'`; do showrev -p | grep $pkg; done | awk '{print $2 "\t" $7}' | uniq

It returns the package info in a form such as:

113210-03 VRTSfspro
112392-06 VRTSvmman
113596-03 VRTSvmpro
113206-10 VRTSvxfs


Thing is I want to run it over an ssh connection on remote servers, you would think at first it would look something like this:

ssh apollo "for pkg in `pkginfo" | grep -i VRTS | awk '{print $2}'`; do showrev -p | grep $pkg; done | awk '{print $2 "\t" $7}' | uniq

Problem is that due to all the " and ` in that statement things are getting confused and it doesn't run.

Anyone have any ideas on how to format that to get it to work? The stuff in between the " and the " gets run on the remote server but that ` before pkginfo is thowing it off, I think.
LordJezo
# 2  
Old 08-19-2005
why dont you put your command in a script file on the remote server and just use ssh on your own server to run the script and ftp back the output?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issues formatting output of two commands in a single line.

I wish to generate output of two commands in the same line separated by a single white-space. Below is my command and output in the same line. ls -ltr fname1.out | awk '{$2=$4=$5=x; print}' | tr '\n' '\t' | tr -s ' '; cksum<fname1.out | cut -d' ' -f1 Output: -rw-r--r--. root Aug 26 16:57... (6 Replies)
Discussion started by: mohtashims
6 Replies

2. UNIX for Beginners Questions & Answers

Ssh issues

i have two servers that i have installed ssh but i want to copy the public keys from one server to the other using the ssh-copy-id user@x.x.x.x i do get a message to put my password for that user and it then comes out with an error message permission denied after imputing my password for this user... (10 Replies)
Discussion started by: DOkuwa
10 Replies

3. Shell Programming and Scripting

Running test command in ssh

I tried to run the following commands in my shell script. This command works fine for me: ssh -n "${username}"@"${hostname}" "grep WARNING ${serverhome}/${serverlog} | wc -l" The result is: 1548 However when i try to run a similar one: ssh -n "${username}"@"${hostname}" "test `grep -q... (2 Replies)
Discussion started by: hys1117
2 Replies

4. UNIX for Dummies Questions & Answers

Sudo ssh with command running in background

I am trying to run a command. This is one of my attempts: for i in fileservera; do ssh -t $i 'sudo ls /';doneThis works, and I see the directories. However, what I want to do now is start a process on the remote server such as /usr/bin/connectproc -standalonesudo /usr/bin/connectproc... (1 Reply)
Discussion started by: newbie2010
1 Replies

5. Shell Programming and Scripting

Running command using SSH

Hi All, I am trying to run my script using ssh. Below is the code snippet #!/bin/bash ssh username@useipapd03 'bash -s' #To ensure If JMSdirectory exists or not if then echo "JMS mounts................exist'>>OutputResult.txt else echo "JMS mounts................not... (10 Replies)
Discussion started by: sharsour
10 Replies

6. Shell Programming and Scripting

ssh code issues

Hi guys. I intend to develop a script to perform certain activities on several servers at the same time. Currently I am working with 2 servers only. I want to ssh for M1 over to M2 and run some commands. My code is like this at M1: #!/bin/bash ssh M2 cd /tmp mkdir folder1 cd folder1... (2 Replies)
Discussion started by: Junaid Subhani
2 Replies

7. Shell Programming and Scripting

ssh - running remote command not exiting

Hi, i have a shellscript, where in i need to connect to different server start these three jobs and exit from the server and start the same three jobs on local server. ssh user@remotehost 'bash -s' << EOF ${GETT_HOME}/bin/start1 & sleep 10 ${GETT_HOME}/bin/start2 & sleep 10... (1 Reply)
Discussion started by: swapnabhargav
1 Replies

8. UNIX for Dummies Questions & Answers

swap issues, system is running at 99%

Hi All, I am trying to understand why my system is running at very high. This system is almost out of memory. See below. swapon -s Filename Type Size Used Priority /dev/mapper/VolGroup00-LogVol02 partition 8388600 8235088 -1... (2 Replies)
Discussion started by: samnyc
2 Replies

9. Red Hat

issues with ssh login

I have a Rhel 3 machine. I can login to it through telnet. The config files /etc/ssh/sshd_config and /etc/ssh/ssh_config has not been modified. But the IP address of the system was changed. Could this be issue? It was earlier configured for passwordless login(dsa). I tried moving the... (4 Replies)
Discussion started by: kirtikjr
4 Replies

10. Shell Programming and Scripting

Cron job giving error while running SSH command

Hi All, The script which i am using to SSH to remote server is working fine when i run is using ./ but when cron runs it it gives error that "ssh: not found" please help!!! (3 Replies)
Discussion started by: visingha
3 Replies
Login or Register to Ask a Question