DeepankAtish
DeepankAtish

Reputation: 35

ssh command does not exit even after doing its job

ssh [email protected] 'more /home/GJMEHUL/.bash_history > /home/GJMEHUL/smsc_cmdlog_12Apr12_GJMEHUL.txt'

The above command which i've stored in a script called alarmtest.sh. Ive already set ssh keys. the problem is even though the command is doing its job it does not stop and I have to manually kill it using Ctrl+C.

When I tried the command below in a script:

ssh [email protected] 'who > /home/GJMEHUL/smsc_cmdlog_12Apr12_GJMEHUL.txt'

it worked perfectly.

Why is ssh command behaving like this?

Upvotes: 2

Views: 547

Answers (2)

Rob
Rob

Reputation: 1143

You use "more", which waits for user interaction. Maybe you'd rather like to use cat or a simple cp?

Upvotes: 1

jon
jon

Reputation: 6246

The more command is interactive.

You should use cat or head or tail.

Upvotes: 3

Related Questions