1

I have the following logs:

S1 # ls /var/log/*/server
/var/log/P3/server:
apps  logs

/var/log/P4/server:
apps  logs

/var/log/S1/server:
apps  logs

--I would like to cycle through them via ssh specifically (for prototyping something more elaborate) but I can't, it will repeat one of the files three times rather then going through all 3:

SC-1# ssh SC-1 "for i in /var/log/*/server; do echo $i; done"
/var/log/SC-1/server
/var/log/SC-1/server
/var/log/SC-1/server

Also it is not possible for me to put this in a script and then ssh to run the script

1 Answer 1

1

Use single quotes to prevent $i from being interpolated by the outer shell.

ssh SC-1 'for i in /var/log/*/server; do echo $i; done'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.