JasonSmith
JasonSmith

Reputation: 27

Editing a vi file using bash script

I am doing bash scripting in RHEL7. I managed to do some simple if-else scripting, however, I now need to edit /etc/ssh/sshd_config file using bash script. I have to remove the '#' at protocol 2. Is there any way to do this? In addition I would like to add the Protocol 2 line in if it does not exist. I would appreciate any help given.

ssh_config

Upvotes: 0

Views: 590

Answers (1)

Gilbert
Gilbert

Reputation: 3776

@Michel O beat me with sed -i, but for more complex edits there is also ex, which gives you the power of vi from command lines.

Upvotes: 2

Related Questions